In [ ]:
%%capture
!pip install pyvis
!pip install bokeh
!pip install node2vec
In [ ]:
import pandas as pd
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.manifold import TSNE
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline
from sklearn.model_selection import GridSearchCV,RepeatedStratifiedKFold,RandomizedSearchCV
from sklearn.linear_model import LogisticRegression
from  xgboost import XGBClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import classification_report
from sklearn.metrics import confusion_matrix
from node2vec import Node2Vec
from itertools import combinations
from pyvis.network import Network
from IPython.core.display import display, HTML
import warnings
warnings.filterwarnings("ignore")
In [ ]:
data = pd.read_csv('/content/drive/MyDrive/DA 516 - Network Project/data.csv')
print(data.shape)
data.head()
(65053, 4)
Out[ ]:
Month # White Player # Black Player # Score
0 1 73 1246 0.5
1 1 73 5097 0.5
2 1 73 5104 0.5
3 1 73 7321 1.0
4 1 73 7375 0.5

Train-Test Split with Random sampling from players who had more than 1 match

In [ ]:
white=pd.DataFrame(data.groupby('White Player #')['Score'].count()).reset_index().rename(columns = {'White Player #':'PlayerId','Score':'MatchCount'})
black=pd.DataFrame(data.groupby('Black Player #')['Score'].count()).reset_index().rename(columns = {'Black Player #':'PlayerId','Score':'MatchCount'})
all_count = pd.concat([white,black])
all_count  = pd.DataFrame(all_count.groupby('PlayerId')['MatchCount'].sum()).reset_index()
all_count = all_count[all_count.MatchCount > 1]
random_sample_players = all_count['PlayerId'].sample(2000)
test = data[(data['White Player #'].isin(random_sample_players)) & (data['Black Player #'].isin(random_sample_players))].reset_index(drop = True)
print('Test Shape :',test.shape)
print('')
print('Test distribution %:')
print(test.Score.value_counts() / len(test))
print('')
train = data[~((data['White Player #'].isin(test['White Player #'])) &  (data['Black Player #'].isin(test['Black Player #'])) & 
             (data['Month #'].isin(test['Month #'])) & (data['Score'].isin(test['Score'])))].reset_index(drop = True)
print('Train shape :',train.shape)
print('')
print('Train distribution % :')
print(train.Score.value_counts() / len(train))
print('')
train.head()
Test Shape : (6303, 4)

Test distribution %:
0.5    0.440584
1.0    0.320800
0.0    0.238617
Name: Score, dtype: float64

Train shape : (58750, 4)

Train distribution % :
0.5    0.440664
1.0    0.325804
0.0    0.233532
Name: Score, dtype: float64

Out[ ]:
Month # White Player # Black Player # Score
0 1 73 1246 0.5
1 1 73 5097 0.5
2 1 73 5104 0.5
3 1 73 7321 1.0
4 1 73 7375 0.5
In [ ]:
### Checking if there is any player only in test data
train_white_players = train['White Player #'].unique().tolist()
train_black_players = train['Black Player #'].unique().tolist()
train_players = pd.concat([pd.DataFrame(train_white_players), pd.DataFrame(train_black_players)]).rename(columns = {0:'PlayerID'})
test_white_players = test['White Player #'].unique().tolist()
test_black_players = test['Black Player #'].unique().tolist()
test_players = pd.concat([pd.DataFrame(test_white_players), pd.DataFrame(test_black_players)]).rename(columns = {0:'PlayerID'})
only_test_players = test_players[~(test_players.PlayerID.isin(train_players.PlayerID))]
print('Player # have randomly selected as test which does not exist in train:',len(only_test_players))
Player # have randomly selected as test which does not exist in train: 40
In [ ]:
### Deleting those players from test dataset, in order to make sure we have test players in train as well for being able to calculate features
print('Test shape before eleminating unique test players : ' , test.shape)
test = test[~(test['White Player #'].isin(only_test_players.PlayerID)) & ~(test['Black Player #'].isin(only_test_players.PlayerID))]
print('Test shape after eleminating unique test players : ' ,test.shape)
Test shape before eleminating unique test players :  (6303, 4)
Test shape after eleminating unique test players :  (6239, 4)
In [ ]:
train.to_csv('/content/drive/MyDrive/DA 516 - Network Project/train.csv',index = False)
test.to_csv('/content/drive/MyDrive/DA 516 - Network Project/test.csv',index = False)
In [ ]:
train = pd.read_csv('/content/drive/MyDrive/DA 516 - Network Project/train.csv')
test = pd.read_csv('/content/drive/MyDrive/DA 516 - Network Project/test.csv')
print(train.shape)
print(test.shape)
train.head()
(58750, 4)
(6239, 4)
Out[ ]:
Month # White Player # Black Player # Score
0 1 73 1246 0.5
1 1 73 5097 0.5
2 1 73 5104 0.5
3 1 73 7321 1.0
4 1 73 7375 0.5

Player Statistic Based Features

In [ ]:
train_source = train[['White Player #','Score']]
train_source['Score'] = np.where(train_source.Score == 1, 'white_win', np.where(train_source.Score == 0, 'white_lost', 'white_draw'))
train_source.rename(columns = {'White Player #':'Player'},inplace = True)
train_target = train[['Black Player #','Score']]
train_target['Score'] = np.where(train_target.Score == 0, 'black_win', np.where(train_target.Score == 1, 'black_lost', 'black_draw'))
train_target.rename(columns = {'Black Player #':'Player'},inplace = True)
train_df = pd.concat([train_source,train_target],0)
train_df.head()
Out[ ]:
Player Score
0 73 white_draw
1 73 white_draw
2 73 white_draw
3 73 white_win
4 73 white_draw
In [ ]:
player_stats = pd.DataFrame(train_df.groupby(['Player','Score'])['Score'].describe()).reset_index()
player_stats = pd.DataFrame(player_stats.pivot(index = 'Player',columns = 'Score', values = 'count').fillna(0)).reset_index()
player_stats['total_score'] = (player_stats.black_draw+player_stats.white_draw)*0.5 +(player_stats.black_win+player_stats.white_win)
player_stats['total_game_count'] = player_stats[['black_draw','black_lost','black_win','white_draw','white_lost','white_win']].sum(axis=1)
player_stats['Avg_Score'] = player_stats.total_score / player_stats.total_game_count
player_stats.head()
Out[ ]:
Score Player black_draw black_lost black_win white_draw white_lost white_win total_score total_game_count Avg_Score
0 1 9 9 6 9 3 16 31.0 52 0.596154
1 2 1 0 0 0 0 0 0.5 1 0.500000
2 3 4 1 0 2 1 0 3.0 8 0.375000
3 4 12 6 6 15 3 4 23.5 46 0.510870
4 5 1 1 2 1 4 1 4.0 10 0.400000
In [ ]:
plt.figure(figsize=(12,6))
plt.boxplot(player_stats.Avg_Score)
plt.show()
In [ ]:
plt.figure(figsize=(12,6))
plt.hist(player_stats.total_game_count,bins = 100)
plt.show()

Visulizing Connection between players who played more than 150 Games, with total earned points against each other as weight

In [ ]:
more_than_hundred_game = player_stats[player_stats.total_game_count > 150]['Player'].unique()
sub_ = train[train['White Player #'].isin(more_than_hundred_game)]
sub_ = sub_[sub_['Black Player #'].isin(more_than_hundred_game)]
sub_.drop(columns ='Month #',inplace = True)
sub_.head()
Out[ ]:
White Player # Black Player # Score
111 2283 8388 0.5
225 4194 1594 0.5
284 5187 8152 0.5
384 6850 4194 0.5
478 8152 1594 1.0
In [ ]:
train_white = sub_[sub_.Score !=0]
train_black = sub_[sub_.Score !=1]
train_black['Score'] = np.where(train_black.Score == 0,1,train_black.Score)
train_white = pd.DataFrame(train_white.groupby(['White Player #','Black Player #'])['Score'].sum()).reset_index()
train_black = pd.DataFrame(train_black.groupby(['White Player #','Black Player #'])['Score'].sum()).reset_index()
train_white.rename(columns = {'White Player #':'Source','Black Player #':'Target'},inplace = True)
train_black.rename(columns = {'White Player #':'Target','Black Player #':'Source'},inplace = True)
train_weighted = pd.concat([train_white,train_black])
train_weighted.rename(columns = {'Score': 'Weight'},inplace = True)
train_weighted = train_weighted.groupby(['Source','Target'])['Weight'].sum().reset_index()
train_weighted.head()
Out[ ]:
Source Target Weight
0 64 386 2.5
1 64 391 1.0
2 64 1187 0.5
3 64 1286 2.5
4 64 1373 2.0
In [ ]:
data_weighted = nx.from_pandas_edgelist(train_weighted, source='Source', target='Target', edge_attr=True, create_using = nx.DiGraph())

plt.rcParams['figure.figsize'] = [30, 30]
pos = nx.spring_layout(data_weighted, scale = 2, seed = 42,weight='Weight')
nx.draw_networkx_nodes(data_weighted, pos, node_color='pink', node_size=150)
nx.draw_networkx_edges(data_weighted, pos, edgelist=data_weighted.edges())
nx.draw_networkx_labels(data_weighted, pos, font_size=14, font_family="sans-serif", )
labels = nx.get_edge_attributes(data_weighted,'Weight')
nx.draw_networkx_edge_labels(data_weighted,pos,edge_labels=labels)
ax = plt.gca()
ax.margins(0.05)
plt.axis("off")
plt.tight_layout()
plt.show()
In [ ]:
data_weighted = nx.from_pandas_edgelist(train_weighted, source='Source', target='Target', edge_attr=True, create_using = nx.DiGraph())

plt.rcParams['figure.figsize'] = [30, 30]
pos = nx.kamada_kawai_layout(data_weighted, scale = 0.5,weight='Weight')
nx.draw_networkx_nodes(data_weighted, pos, node_color='pink', node_size=150)
nx.draw_networkx_edges(data_weighted, pos, edgelist=data_weighted.edges())
nx.draw_networkx_labels(data_weighted, pos, font_size=12, font_family="sans-serif", )
labels = nx.get_edge_attributes(data_weighted,'Weight')
nx.draw_networkx_edge_labels(data_weighted,pos,edge_labels=labels)
ax = plt.gca()
ax.margins(0.05)
plt.axis("off")
plt.tight_layout()
plt.show()
In [ ]:
tmp1 = Network(height='600px', width='70%',notebook=True,heading='Viz')

tmp1.from_nx(data_weighted)

tmp1.show_buttons(filter_=['physics'])
tmp1.show('viz.html')
display(HTML('viz.html'))

Viz

Centralities

In [ ]:
%%time
edge_list_centr = nx.from_pandas_edgelist(train, source='White Player #', target='Black Player #', create_using = nx.Graph())
dgc = nx.degree_centrality(edge_list_centr)
eig = nx.eigenvector_centrality(edge_list_centr)
pgr = nx.pagerank(edge_list_centr)
cls = nx.closeness_centrality(edge_list_centr)
btw = nx.betweenness_centrality(edge_list_centr)
cr = pd.DataFrame(index=edge_list_centr.nodes())
cr['dgc'] = cr.index.map(dgc)
cr['eig'] = cr.index.map(eig)
cr['pgr'] = cr.index.map(pgr)
cr['cls'] = cr.index.map(cls)
cr['btw'] = cr.index.map(btw)
cr.to_csv('/content/drive/MyDrive/DA 516 - Network Project/train_centrality.csv')
CPU times: user 12min 9s, sys: 2.17 s, total: 12min 12s
Wall time: 12min 10s
In [ ]:
cr = pd.read_csv('/content/drive/MyDrive/DA 516 - Network Project/train_centrality.csv')
cr = cr.rename(columns = {'Unnamed: 0': 'Player'})
cr.head()
Out[ ]:
Player dgc eig pgr cls btw
0 73 0.005775 0.007068 0.000310 0.290054 0.000721
1 1246 0.008662 0.044762 0.000401 0.315980 0.001156
2 5097 0.008387 0.017293 0.000412 0.307067 0.001005
3 5104 0.001650 0.005471 0.000103 0.274586 0.000165
4 7321 0.002337 0.003249 0.000154 0.269300 0.000353

NETWORK ANALYSIS of all MATCHES

In [ ]:
 df=pd.DataFrame(train.groupby(['White Player #','Black Player #'])['Score'].count()).reset_index()
In [ ]:
df.Score.sum()
Out[ ]:
58750
In [ ]:
G = nx.from_pandas_edgelist(df, source='White Player #', target='Black Player #', edge_attr=True, create_using = nx.Graph())
In [ ]:
G_und = G.to_undirected(reciprocal=False)

for u, v, d in G_und.edges(data=True):
    G_und[u][v]['Score'] = 0

for u, v, d in G.edges(data=True):
    G_und[u][v]['Score'] += G[u][v]['Score']

for analysing network we create a undirected network

In [ ]:
G_und = G.to_undirected(reciprocal=False)

for u, v, d in G_und.edges(data=True):
    G_und[u][v]['Score'] = 0

for u, v, d in G.edges(data=True):
    G_und[u][v]['Score'] += G[u][v]['Score']
In [ ]:
print(nx.info(G_und))
Name: 
Type: Graph
Number of nodes: 7274
Number of edges: 50475
Average degree:  13.8782
In [ ]:
import collections
import matplotlib.pyplot as plt

degree_sequence = sorted([d for n, d in G_und.degree()], reverse=True)  # degree sequence
degreeCount = collections.Counter(degree_sequence)
deg, cnt = zip(*degreeCount.items())

fig, ax = plt.subplots()
plt.bar(deg, cnt, width=0.80, color="b")

plt.title("Degree Histogram")
plt.ylabel("Count")
plt.xlabel("Degree")
ax.set_xticks([d + 0.4 for d in deg])
ax.set_xticklabels(deg)

plt.show()
In [ ]:
strengths = [G_und.degree(n, weight='Score') for n in G_und.nodes()]
plt.hist(strengths, bins = 8)
plt.show()
In [ ]:
sum(strengths)/len(strengths)
Out[ ]:
16.153423150948583
In [ ]:
cliques = list(nx.find_cliques(G_und))
cliques
Out[ ]:
[[1, 4609, 1377],
 [1, 4609, 7238, 5833],
 [1, 4609, 5170, 6110, 5472],
 [1, 4609, 5170, 6110, 2463],
 [1, 4609, 701],
 [1, 8449],
 [1, 5895],
 [1, 4488, 8035, 2533],
 [1, 5385],
 [1, 6281, 2225, 5394, 235],
 [1, 6281, 4822],
 [1, 8585],
 [1, 7816, 3105],
 [1, 7816, 6587],
 [1, 7816, 3614, 2463],
 [1, 7053],
 [1, 4751, 2225],
 [1, 3347],
 [1, 3105, 76],
 [1, 3105, 2805, 1645],
 [1, 3108, 6982],
 [1, 8103],
 [1, 1707, 701, 1383],
 [1, 1712],
 [1, 4406],
 [1, 8248, 8288],
 [1, 8248, 488],
 [1, 8248, 6110],
 [1, 5951],
 [1, 6982, 8288],
 [1, 3655, 1377],
 [1, 76, 5472],
 [1, 76, 7238],
 [1, 4686, 8035],
 [1, 4822, 5170, 6110, 2463],
 [1, 2007],
 [1, 4696],
 [1, 5846],
 [1, 5342, 2533],
 [1, 3683, 701],
 [1, 2533, 5833],
 [1, 3065],
 [1, 2683, 7238],
 [1, 3837, 5833, 7238],
 [2, 4179],
 [3, 4931, 319],
 [3, 8419, 6677],
 [3, 231],
 [3, 2760],
 [3, 3147],
 [3, 3883],
 [4, 2574, 8016, 428],
 [4, 8465, 5850],
 [4, 8465, 7477],
 [4, 8465, 7094],
 [4, 8465, 5671],
 [4, 6937, 7900],
 [4, 6937, 902],
 [4, 3995],
 [4, 2084, 7900],
 [4, 2084, 7477],
 [4, 2084, 7094],
 [4, 934, 5477],
 [4, 5671, 5753],
 [4, 5671, 2250],
 [4, 5671, 5477],
 [4, 5415, 8133],
 [4, 5415, 2813],
 [4, 4777, 8433],
 [4, 4777, 7900],
 [4, 6185, 2129],
 [4, 6185, 5082],
 [4, 2091, 8433, 5082, 5136],
 [4, 2091, 8433, 5082, 4694],
 [4, 2091, 8433, 5082, 7751],
 [4, 2091, 8433, 2813],
 [4, 2091, 8433, 902, 5136],
 [4, 2091, 8433, 902, 4694],
 [4, 2091, 596, 5136, 5082],
 [4, 2091, 596, 5136, 902],
 [4, 2091, 596, 7751, 5082],
 [4, 813],
 [4, 1452],
 [4, 7477, 7029, 598],
 [4, 2250, 7900],
 [4, 2250, 4694],
 [4, 8016, 1019],
 [4, 598, 7029, 5850],
 [4, 3544, 5477],
 [4, 5850, 5995],
 [4, 3818],
 [4, 5995, 596],
 [4, 1517],
 [4, 6010],
 [4, 3198],
 [5, 870, 7849],
 [5, 870, 3619, 96],
 [5, 870, 3619, 6717],
 [5, 2919, 5272],
 [5, 2919, 8045, 7849],
 [5, 2919, 8045, 2548],
 [5, 8045, 4854, 7849],
 [5, 8045, 4854, 2548],
 [5, 4854, 5272],
 [6, 5440, 3025],
 [6, 5440, 5676, 1302],
 [6, 5347],
 [6, 488, 3861],
 [6, 5004, 5676, 1302],
 [6, 6573],
 [6, 7281],
 [6, 7698],
 [7, 3728, 4121, 1996],
 [7, 4244, 5495],
 [7, 5396],
 [7, 1563],
 [7, 1567, 1996, 5839],
 [7, 7199, 8482],
 [7, 7199, 6061],
 [7, 7199, 5839],
 [7, 8482, 1065],
 [7, 6061, 1856, 1591],
 [7, 6061, 7000],
 [7, 1856, 2742, 6073],
 [7, 1856, 5839, 6073],
 [7, 1856, 5839, 1202],
 [7, 5826, 2472],
 [7, 5826, 1996, 4121, 5839, 6073],
 [7, 5826, 1996, 4121, 5839, 1202],
 [7, 5826, 1996, 4121, 1591],
 [7, 5826, 1996, 8324],
 [7, 5826, 2742, 6073],
 [7, 7362],
 [7, 6339, 2256],
 [7, 2773],
 [7, 7000, 2742],
 [7, 4699, 4121],
 [7, 4699, 5495],
 [7, 2271],
 [7, 5472],
 [7, 5495, 6073],
 [8, 7751],
 [9, 5764],
 [9, 8629],
 [9, 3278],
 [10, 1161, 6819, 4506],
 [10, 1161, 6819, 4971],
 [10, 1161, 2542],
 [12, 3655, 813],
 [12, 3655, 7989],
 [12, 3655, 8311],
 [12, 3739],
 [12, 636],
 [12, 7006],
 [12, 4063, 813],
 [12, 4063, 7989],
 [12, 4063, 8311],
 [13, 6759],
 [14, 4775],
 [16, 3540],
 [16, 941],
 [16, 7750, 2002],
 [16, 2015],
 [17, 595],
 [18, 6049, 7441],
 [18, 6049, 7242],
 [18, 6049, 2957],
 [18, 6049, 8629],
 [18, 7620],
 [18, 5419, 2271, 8629],
 [18, 5419, 4283],
 [18, 5419, 2599, 840, 7069],
 [18, 5419, 2599, 7242],
 [18, 5419, 2599, 2957],
 [18, 5419, 2599, 1615],
 [18, 5419, 2599, 8629],
 [18, 6924],
 [18, 19, 6261],
 [18, 19, 1615],
 [18, 3540, 2908],
 [18, 661],
 [18, 2683, 8629, 2599],
 [18, 1533, 840, 7069],
 [18, 1533, 7242],
 [18, 1533, 2957],
 [18, 4287],
 [19, 8224],
 [19, 4226],
 [19, 3431, 2925],
 [19, 1869],
 [19, 2806, 6552],
 [21, 8000, 3464],
 [21, 6786],
 [21, 77],
 [21, 2321],
 [21, 3635],
 [21, 7604],
 [21, 5811],
 [23, 2936],
 [24, 5798, 4446],
 [24, 8219],
 [24, 4778],
 [24, 6864],
 [24, 7347],
 [24, 6007],
 [24, 2203],
 [25, 5778],
 [25, 5317],
 [26, 2472],
 [26, 8324],
 [26, 3574, 6015],
 [26, 860],
 [27, 2560, 1020],
 [27, 6536, 8011],
 [27, 562, 6776],
 [27, 562, 1020],
 [27, 2685],
 [29, 8324, 6647],
 [29, 4101],
 [29, 7943, 6647],
 [29, 5839, 1272],
 [29, 5839, 4241],
 [29, 5436],
 [30, 3675],
 [30, 59],
 [30, 6555],
 [31, 8320],
 [32, 3505],
 [32, 2182],
 [34, 1673],
 [34, 8111],
 [34, 2579],
 [34, 8115],
 [34, 664],
 [35, 3720],
 [35, 4873, 8048],
 [35, 1994],
 [35, 4150],
 [35, 828],
 [36, 64],
 [36, 2084],
 [36, 1126, 3612],
 [36, 2737, 6985],
 [36, 2737, 614],
 [36, 4562],
 [36, 1522],
 [36, 8342],
 [36, 2105],
 [36, 1178],
 [36, 6010],
 [39, 6680],
 [40, 6632],
 [40, 2849, 6670],
 [40, 5420],
 [40, 6054, 934],
 [40, 6054, 6670],
 [42, 8321],
 [42, 5963],
 [43, 3489, 3870],
 [43, 7074, 3843],
 [43, 7074, 220],
 [43, 7428, 6968],
 [43, 7428, 3509],
 [43, 7619, 1500, 6532],
 [43, 7619, 1500, 2847],
 [43, 7619, 6835, 7061, 4137],
 [43, 7619, 6835, 7061, 595],
 [43, 7619, 6835, 2847],
 [43, 6753, 6968],
 [43, 6753, 1977],
 [43, 6753, 1500],
 [43, 619, 6532],
 [43, 619, 7983],
 [43, 7983, 7709],
 [43, 3505],
 [43, 6493, 7962],
 [43, 6968, 6532],
 [43, 1977, 2847],
 [43, 220, 2847],
 [43, 7709, 1500, 6532],
 [43, 3870, 4137],
 [43, 3870, 2847],
 [44, 6757],
 [45, 7425],
 [45, 5826, 2472],
 [45, 5826, 5916],
 [45, 6647],
 [45, 4699],
 [45, 2717],
 [46, 8617, 2888, 7747],
 [46, 8617, 1126],
 [46, 699, 1126],
 [46, 2838],
 [48, 3210],
 [48, 4518],
 [48, 462],
 [49, 591, 6162, 8291],
 [49, 591, 6162, 8285],
 [49, 591, 2716, 3593, 4379],
 [49, 591, 8326, 3593, 4379],
 [49, 591, 8326, 3593, 8285],
 [49, 591, 8326, 8291],
 [49, 591, 8326, 5879],
 [49, 591, 1855, 3593, 4379],
 [51, 7364, 7298],
 [51, 7364, 1019],
 [51, 6212, 7412],
 [51, 2532],
 [51, 4201],
 [51, 4714, 1019],
 [51, 4714, 3542, 6582],
 [51, 6346, 7298],
 [51, 6346, 1019, 5852],
 [51, 6346, 7412],
 [51, 7312],
 [51, 2070],
 [51, 279],
 [51, 1148],
 [52, 2145],
 [52, 7817],
 [52, 4710],
 [52, 2799, 6228],
 [53, 7395, 5006],
 [54, 7877],
 [54, 6378],
 [54, 3610],
 [54, 2996],
 [54, 1620],
 [54, 3671],
 [54, 6650],
 [54, 2811],
 [54, 4317],
 [55, 3048, 2640, 2038, 638],
 [55, 3048, 4543],
 [55, 5257, 5364],
 [55, 5257, 6628, 1304, 2640, 2038, 638],
 [55, 5257, 6628, 1304, 2640, 2038, 3054],
 [55, 5257, 6628, 1304, 7322, 638],
 [55, 4725, 638, 2038],
 [56, 7416],
 [56, 5763],
 [56, 391, 4850],
 [56, 391, 2867],
 [56, 391, 3614],
 [56, 391, 2271],
 [56, 5255],
 [56, 5289],
 [56, 2762, 5356, 1700],
 [56, 2552, 5504],
 [56, 2552, 2032, 5107],
 [56, 2552, 5419],
 [56, 2552, 1700, 5107],
 [56, 2552, 1700, 5356],
 [56, 6220],
 [56, 4850, 5419],
 [56, 5044],
 [56, 2168],
 [56, 1657],
 [56, 2271, 5419],
 [57, 4740],
 [57, 6125],
 [58, 8385],
 [58, 4564],
 [58, 2308],
 [58, 3511],
 [59, 6369],
 [59, 1955],
 [59, 7560],
 [59, 5010, 7516],
 [59, 7860],
 [59, 4537],
 [59, 7323],
 [60, 6075],
 [60, 5454],
 [61, 2978],
 [61, 6307, 8092],
 [61, 6307, 5487, 376],
 [61, 6307, 5487, 946],
 [61, 7576, 732],
 [61, 2202, 5487, 376],
 [61, 2202, 5487, 946],
 [62, 81],
 [62, 7929, 4407],
 [63, 6993],
 [63, 8274],
 [63, 2771],
 [65, 1048],
 [65, 7587, 7346],
 [65, 7587, 540],
 [66, 7489],
 [66, 2987, 1241],
 [66, 2987, 524],
 [66, 2987, 5302],
 [66, 6065, 524],
 [67, 6982, 1964],
 [67, 2696],
 [67, 7375],
 [67, 3089],
 [67, 1112],
 [67, 1661, 7201, 313],
 [67, 1661, 7201, 263],
 [67, 1661, 5990, 263],
 [68, 3378],
 [68, 5125],
 [68, 5663, 8195],
 [68, 5663, 4157, 7391],
 [68, 5663, 4382, 6366, 1814],
 [68, 5663, 4382, 7391],
 [69, 3016],
 [71, 4812],
 [71, 748, 304],
 [71, 501],
 [71, 6263],
 [71, 793],
 [71, 639],
 [72, 2603, 3567],
 [73, 8599, 5097, 3944, 3983],
 [73, 8599, 5097, 231],
 [73, 7575, 6856, 1706],
 [73, 7575, 5097, 1880],
 [73, 7575, 5097, 6740],
 [73, 7575, 5097, 1006],
 [73, 536, 1109],
 [73, 4761, 3983, 8405],
 [73, 4761, 6740],
 [73, 4761, 231, 7353],
 [73, 2203, 8405, 1455],
 [73, 2203, 1006, 7353],
 [73, 2203, 1006, 1455],
 [73, 2346, 1109],
 [73, 7353, 5097, 2033],
 [73, 7353, 5097, 1006, 231],
 [73, 7353, 3405],
 [73, 6458, 3944, 7411, 5070],
 [73, 6458, 5575],
 [73, 7483, 1880],
 [73, 4807, 6119],
 [73, 6740, 3405],
 [73, 8405, 1455, 1880],
 [73, 2647],
 [73, 5463, 1880],
 [73, 5209, 1455, 1880],
 [73, 5209, 1455, 418],
 [73, 5209, 1455, 4216, 6119],
 [73, 4216, 3944, 1455],
 [73, 3961, 6856],
 [73, 3961, 3983],
 [73, 6268, 6856, 3944, 1706],
 [73, 6268, 6856, 2033],
 [73, 6268, 5097, 231, 1006],
 [73, 6268, 5097, 231, 5575],
 [73, 6268, 5097, 3983, 1006, 3944],
 [73, 6268, 5097, 3983, 1006, 7375],
 [73, 6268, 5097, 1455, 418, 1246],
 [73, 6268, 5097, 1455, 3944, 1880],
 [73, 6268, 5097, 1455, 3944, 1006],
 [73, 6268, 5097, 1455, 7375, 5104, 5575],
 [73, 6268, 5097, 1455, 7375, 1006],
 [73, 6268, 5097, 2033, 1880],
 [73, 6268, 5097, 3987, 1006, 7038],
 [73, 6268, 5097, 3987, 1006, 7375],
 [73, 6268, 3405],
 [73, 6268, 7411, 1455, 3944],
 [73, 6268, 7411, 1455, 7375],
 [73, 6268, 7321, 5104, 5575, 7375],
 [73, 6268, 1759, 7038, 1006],
 [74, 5285],
 [75, 3985, 727],
 [75, 3985, 1420],
 [75, 3985, 4279],
 [75, 6434, 7884, 1840, 4279],
 [75, 6434, 7884, 1840, 727],
 [75, 6434, 7884, 1915, 4279],
 [75, 6434, 7884, 1915, 727],
 [75, 6434, 1420, 1915],
 [77, 4672, 517],
 [77, 4672, 6525],
 [77, 4672, 7791],
 [77, 4962],
 [77, 8036],
 [77, 3654],
 [77, 7178],
 [77, 1482],
 [77, 7379],
 [77, 2643],
 [77, 471],
 [77, 2232, 6525],
 [78, 7802],
 [78, 639],
 [79, 6628, 4261],
 [79, 7004],
 [80, 1696],
 [80, 3496],
 [80, 7308],
 [80, 941, 7002],
 [80, 6451, 2015],
 [82, 2903, 4576],
 [82, 2903, 1716, 4287],
 [83, 4063, 801, 813],
 [83, 4063, 1977],
 [83, 4063, 1903],
 [83, 2991],
 [84, 4105, 8083, 7520, 1388],
 [84, 4105, 8083, 7520, 4766],
 [84, 4105, 8083, 5025],
 [84, 4105, 8083, 6283],
 [84, 683, 6283],
 [84, 683, 1388],
 [84, 683, 4766],
 [85, 3328, 7141],
 [85, 5128, 7325],
 [85, 5866],
 [85, 8016],
 [85, 885, 3010],
 [85, 885, 3283, 7325],
 [85, 885, 7548],
 [85, 8375, 3283],
 [85, 8375, 7548],
 [85, 3834, 7325],
 [86, 6866, 2645, 2603, 6989],
 [86, 6866, 2645, 2603, 4175, 591],
 [86, 6866, 2645, 2667, 4175, 591],
 [88, 7491],
 [88, 1860, 2409],
 [88, 4858],
 [88, 1033],
 [88, 3834],
 [88, 2684],
 [89, 490],
 [90, 1769],
 [91, 6942],
 [92, 8174],
 [93, 1491],
 [95, 5776],
 [95, 7225],
 [95, 2398],
 [95, 6783],
 [96, 1281, 8355, 6196],
 [96, 1281, 2605],
 [96, 1538, 870, 8121, 856],
 [96, 1538, 870, 8121, 8415],
 [96, 1538, 870, 3619, 856, 7565],
 [96, 1538, 870, 3619, 1340],
 [96, 1538, 1779, 3619, 1340],
 [96, 1538, 1779, 5876],
 [96, 1538, 1779, 6196, 8415],
 [96, 1538, 6808, 856],
 [96, 1538, 6589, 8415],
 [96, 515, 6993],
 [96, 515, 2605],
 [96, 515, 4073],
 [96, 1539, 409],
 [96, 5378, 856],
 [96, 6029, 3657],
 [96, 6029, 4898],
 [96, 6029, 1779],
 [96, 4375, 7139],
 [96, 6302],
 [96, 4898, 4073],
 [96, 4898, 4004],
 [96, 8355, 3619, 856],
 [96, 8355, 3619, 1779],
 [96, 8355, 6196, 1779],
 [96, 4004, 8415],
 [96, 2605, 6808],
 [96, 2605, 1779],
 [96, 2605, 1397],
 [96, 4805],
 [96, 1746, 7139],
 [96, 1746, 1397],
 [96, 6880],
 [96, 7139, 8121],
 [96, 2152],
 [96, 4073, 1779, 5876],
 [96, 4073, 1779, 1340],
 [96, 4073, 1779, 8415],
 [96, 4073, 1397],
 [96, 4846],
 [96, 1397, 856],
 [97, 4732],
 [98, 4609, 5472, 5170, 6110],
 [98, 4609, 5472, 8287, 4427],
 [98, 4609, 5472, 8287, 8059],
 [98, 4609, 8059, 1187, 8287],
 [98, 4609, 8059, 7238, 5833],
 [98, 4609, 8059, 7238, 5435],
 [98, 4609, 8059, 1098, 3344],
 [98, 4609, 8059, 1098, 8343],
 [98, 4609, 8059, 3344, 8287],
 [98, 4609, 8059, 8343, 6586],
 [98, 4609, 5833, 2867, 3242],
 [98, 4609, 5833, 7238, 3242, 2479],
 [98, 4609, 5833, 7238, 5886],
 [98, 4609, 4427, 3344, 1098],
 [98, 4609, 4427, 3344, 8287],
 [98, 4609, 4427, 5435],
 [98, 4609, 2235, 5435, 5170, 2867],
 [98, 4609, 5886, 5435, 7238],
 [98, 4609, 7439, 6110],
 [98, 4609, 4850, 1187, 8287],
 [98, 4609, 4850, 3242, 5170],
 [98, 4609, 4850, 3242, 7450],
 [98, 4609, 4850, 3242, 7238, 2479],
 [98, 4609, 4850, 1098, 3344, 2479],
 [98, 4609, 4850, 3344, 8287],
 [98, 4609, 4850, 6586, 7450],
 [98, 4609, 2867, 3242, 5435, 7450],
 [98, 4609, 2867, 3242, 5435, 5170],
 [98, 4609, 5435, 3242, 7238],
 [98, 4609, 6110, 6586],
 [98, 4609, 6110, 2479],
 [98, 4609, 5983],
 [98, 2567, 4776],
 [98, 2567, 4427],
 [98, 2567, 2479],
 [98, 2059, 8084, 6212],
 [98, 8210, 6850, 6110],
 [98, 8210, 6850, 6038],
 [98, 8210, 6235, 6110],
 [98, 543, 2332],
 [98, 543, 5886],
 [98, 1591, 6212],
 [98, 6212, 6850, 4850, 6586],
 [98, 6212, 6850, 4850, 7638],
 [98, 6212, 6850, 8415],
 [98, 6212, 6850, 1594, 7638],
 [98, 6212, 6850, 4399, 6586],
 [98, 6212, 3362, 7638],
 [98, 6212, 3362, 8415],
 [98, 6212, 2663],
 [98, 6212, 1683],
 [98, 6212, 8084, 1594, 7638],
 [98, 6212, 8084, 8415],
 [98, 6212, 6104],
 [98, 6212, 5886, 4399],
 [98, 4171, 3591, 2416, 7238],
 [98, 4171, 3591, 5833, 7238],
 [98, 4171, 3591, 4850, 3344, 1098],
 [98, 4171, 3591, 4850, 3344, 6341],
 [98, 4171, 3591, 4850, 7238],
 [98, 4171, 7306, 4776, 7238],
 [98, 4171, 7306, 3242, 7238, 5435],
 [98, 4171, 7306, 3242, 5191, 1563, 5170, 5435, 2841],
 [98, 4171, 7306, 3242, 5191, 1563, 5170, 5435, 391],
 [98, 4171, 7306, 3242, 5191, 4419, 5435, 7865],
 [98, 4171, 7306, 3242, 5191, 4419, 5435, 5170, 2841],
 [98, 4171, 7306, 3242, 5191, 4419, 5435, 5170, 391],
 [98, 4171, 7306, 3242, 5191, 4419, 7118, 7865],
 [98, 4171, 7306, 3242, 5191, 4419, 7118, 5170, 2841],
 [98, 4171, 7306, 3242, 5191, 4419, 7118, 5170, 391],
 [98, 4171, 7306, 8501, 5170, 2841, 5435, 1563],
 [98, 4171, 7306, 8501, 5170, 2841, 7118],
 [98, 4171, 7306, 8501, 5170, 391, 5435, 1563],
 [98, 4171, 7306, 8501, 5170, 391, 7118],
 [98, 4171, 6926, 1373],
 [98, 4171, 6926, 2663],
 [98, 4171, 2841, 5425, 1563],
 [98, 4171, 2841, 5170, 3242, 7890, 4850],
 [98, 4171, 2841, 5170, 3242, 7890, 2867, 5435],
 [98, 4171, 2841, 5170, 3242, 7890, 5191, 1563, 5435],
 [98, 4171, 2841, 5170, 3242, 7890, 5191, 7118],
 [98, 4171, 2841, 5170, 3242, 1782, 1563, 5435, 5191],
 [98, 4171, 2841, 5170, 3242, 1782, 4850],
 [98, 4171, 2841, 5170, 3242, 1782, 4419, 5435, 2867],
 [98, 4171, 2841, 5170, 3242, 1782, 4419, 5435, 5191],
 [98, 4171, 2841, 5170, 3242, 1782, 4419, 7118, 5191],
 [98, 4171, 2841, 5170, 2235, 5435, 2867],
 [98, 4171, 2841, 5170, 2235, 5435, 1563, 8501],
 [98, 4171, 2841, 5170, 2235, 7118, 8501],
 [98, 4171, 2841, 5170, 8501, 7890, 4850],
 [98, 4171, 2841, 5170, 8501, 7890, 5435, 1563],
 [98, 4171, 2841, 5170, 8501, 7890, 7118],
 [98, 4171, 2841, 1100, 3242, 1563, 5435, 5191],
 [98, 4171, 2841, 1100, 3242, 4419, 5435, 2867],
 [98, 4171, 2841, 1100, 3242, 4419, 5435, 5191],
 [98, 4171, 2841, 1100, 3242, 4419, 7118, 5191],
 [98, 4171, 5534, 1373, 1098, 7638, 2479],
 [98, 4171, 5534, 1373, 5983],
 [98, 4171, 4776, 7238, 5833],
 [98, 4171, 4776, 7238, 8267],
 [98, 4171, 4776, 7238, 5531],
 [98, 4171, 4776, 2663],
 [98, 4171, 2867, 3242, 5833],
 [98, 4171, 2867, 3242, 5435, 1105, 5170],
 [98, 4171, 2867, 3242, 5435, 7890, 391, 5170],
 [98, 4171, 2867, 3242, 5435, 4419, 7865, 1782],
 [98, 4171, 2867, 3242, 5435, 4419, 391, 5170, 1782],
 [98, 4171, 2867, 3242, 5435, 4419, 391, 7450],
 [98, 4171, 8121, 1187, 2416],
 [98, 4171, 8121, 1187, 7953, 1594],
 [98, 4171, 8121, 1187, 4850],
 [98, 4171, 8121, 2479, 4850, 6850, 7238],
 [98, 4171, 8121, 2479, 4850, 7139],
 [98, 4171, 8121, 2479, 4850, 1098, 391],
 [98, 4171, 8121, 2479, 1594, 6850, 7238],
 [98, 4171, 8121, 2479, 1594, 1098, 391],
 [98, 4171, 8121, 2416, 7238],
 [98, 4171, 8121, 7953, 1594, 6850],
 [98, 4171, 8121, 7953, 1594, 1098, 391],
 [98, 4171, 8121, 8415, 6850],
 [98, 4171, 7865, 6104],
 [98, 4171, 7865, 4419, 5191, 3242, 1782, 5435],
 [98, 4171, 7865, 4419, 5191, 3242, 1782, 7118],
 [98, 4171, 5435, 3242, 7450, 1563, 391],
 [98, 4171, 5435, 3242, 7238, 7890],
 [98, 4171, 5435, 3242, 5191, 5170, 1105, 1563],
 [98, 4171, 5435, 3242, 5191, 5170, 1723],
 [98, 4171, 5435, 3242, 5191, 5170, 391, 7890, 1563],
 [98, 4171, 5435, 3242, 5191, 5170, 391, 1782, 1563],
 [98, 4171, 5435, 3242, 5191, 5170, 391, 1782, 4419],
 [98, 4171, 5435, 4427],
 [98, 4171, 5435, 8501, 391, 1563, 7890, 5170],
 [98, 4171, 5435, 8501, 391, 1563, 7450],
 [98, 4171, 5435, 7638, 5531, 7238],
 [98, 4171, 5435, 7638, 5531, 391],
 [98, 4171, 5435, 8415],
 [98, 4171, 6850, 6341, 4850, 3344],
 [98, 4171, 6850, 6341, 4850, 7450],
 [98, 4171, 6850, 2479, 1782, 4850],
 [98, 4171, 6850, 2479, 1782, 1594],
 [98, 4171, 6850, 2479, 7638, 4850, 3344],
 [98, 4171, 6850, 2479, 7638, 4850, 5531, 7238],
 [98, 4171, 6850, 2479, 7638, 1594, 3344],
 [98, 4171, 6850, 2479, 7638, 1594, 5531, 7238],
 [98, 4171, 6850, 2479, 7638, 1594, 1373],
 [98, 4171, 6850, 7953, 7638, 1594, 3344],
 [98, 4171, 6850, 7953, 7638, 1594, 5531],
 [98, 4171, 6850, 7953, 7638, 1594, 1373],
 [98, 4171, 4427, 3344, 1098],
 [98, 4171, 7118, 3242, 7450, 4419, 391],
 [98, 4171, 7118, 3242, 5191, 5170, 1105],
 [98, 4171, 7118, 3242, 5191, 5170, 391, 7890],
 [98, 4171, 7118, 3242, 5191, 5170, 391, 1782, 4419],
 [98, 4171, 7118, 8501, 391, 7890, 5170],
 [98, 4171, 7118, 8501, 391, 7450],
 [98, 4171, 7638, 7953, 1594, 1187, 5531],
 [98, 4171, 7638, 7953, 1594, 391, 1098, 3344],
 [98, 4171, 7638, 7953, 1594, 391, 1098, 5531],
 [98, 4171, 7638, 7953, 1594, 391, 1098, 1373],
 [98, 4171, 7638, 1187, 4850, 5531],
 [98, 4171, 7638, 2479, 5833, 7238],
 [98, 4171, 7638, 2479, 1098, 391, 4850, 3344],
 [98, 4171, 7638, 2479, 1098, 391, 4850, 5531],
 [98, 4171, 7638, 2479, 1098, 391, 1594, 3344],
 [98, 4171, 7638, 2479, 1098, 391, 1594, 5531],
 [98, 4171, 7638, 2479, 1098, 391, 1594, 1373],
 [98, 4171, 7638, 2479, 7139, 4850, 5531],
 [98, 4171, 1373, 2416],
 [98, 4171, 1373, 391, 3242, 2479],
 [98, 4171, 5983, 5425],
 [98, 4171, 5983, 4419],
 [98, 4171, 5983, 5531],
 [98, 4171, 4577, 1187, 5531, 7953, 1594],
 [98, 4171, 4577, 1187, 5531, 4850],
 [98, 4171, 4577, 6341, 4850, 3344],
 [98, 4171, 4577, 6341, 4850, 7450],
 [98, 4171, 4577, 6341, 4850, 8267],
 [98, 4171, 4577, 7238, 7890, 3242, 4850],
 [98, 4171, 4577, 7238, 2479, 5833, 3242],
 [98, 4171, 4577, 7238, 2479, 4850, 3242],
 [98, 4171, 4577, 7238, 2479, 4850, 8267],
 [98, 4171, 4577, 7238, 2479, 4850, 5531],
 [98, 4171, 4577, 7238, 2479, 1594, 5531],
 [98, 4171, 4577, 391, 4419, 3242, 5170, 1782, 5191],
 [98, 4171, 4577, 391, 4419, 3242, 7450],
 [98, 4171, 4577, 391, 4419, 8267],
 [98, 4171, 4577, 391, 5191, 3242, 5170, 1563, 7890],
 [98, 4171, 4577, 391, 5191, 3242, 5170, 1563, 1782],
 [98, 4171, 4577, 391, 7953, 1098, 1594, 3344],
 [98, 4171, 4577, 391, 7953, 1098, 1594, 5531],
 [98, 4171, 4577, 391, 4850, 7890, 5170, 3242],
 [98, 4171, 4577, 391, 4850, 7890, 5170, 8501],
 [98, 4171, 4577, 391, 4850, 7890, 1098],
 [98, 4171, 4577, 391, 4850, 5170, 1782, 3242],
 [98, 4171, 4577, 391, 4850, 7450, 3242],
 [98, 4171, 4577, 391, 4850, 7450, 8501],
 [98, 4171, 4577, 391, 4850, 2479, 3242, 1782],
 [98, 4171, 4577, 391, 4850, 2479, 8501],
 [98, 4171, 4577, 391, 4850, 2479, 1098, 3344],
 [98, 4171, 4577, 391, 4850, 2479, 1098, 8267],
 [98, 4171, 4577, 391, 4850, 2479, 1098, 5531],
 [98, 4171, 4577, 391, 4850, 2479, 1098, 1782],
 [98, 4171, 4577, 391, 1594, 1098, 2479, 3344],
 [98, 4171, 4577, 391, 1594, 1098, 2479, 5531],
 [98, 4171, 4577, 391, 1594, 1098, 2479, 1782],
 [98, 4171, 4577, 391, 1563, 7450, 3242],
 [98, 4171, 4577, 391, 1563, 7450, 8501],
 [98, 4171, 4577, 391, 1563, 8501, 7890, 5170],
 [98, 4171, 4577, 1100, 3242, 5191, 4419],
 [98, 4171, 4577, 1100, 3242, 5191, 1563],
 [98, 4171, 4577, 5425, 1563],
 [98, 4171, 4577, 1105, 3242, 5170, 1563, 5191],
 [98, 4171, 4577, 6228],
 [98, 4171, 4577, 5627, 7953, 1098],
 [98, 4171, 4577, 2235, 5170, 1563, 8501],
 [98, 4171, 7139, 1105, 1563],
 [98, 4171, 7139, 4850, 7450],
 [98, 4171, 7139, 4850, 2479, 8267],
 [98, 4171, 7139, 4850, 2479, 1782],
 [98, 4171, 7139, 1563, 7450],
 [98, 4171, 7139, 1563, 1782],
 [98, 4171, 2663, 1098, 391],
 [98, 4171, 2416, 1187, 5531],
 [98, 4171, 2416, 7238, 7890],
 [98, 4171, 2416, 7238, 5531],
 [98, 76, 5472, 8491],
 [98, 76, 5472, 8287],
 [98, 76, 4577, 7238],
 [98, 76, 4577, 8287],
 [98, 76, 2510, 4861],
 [98, 76, 2867],
 [98, 76, 213, 8491],
 [98, 76, 6270],
 [98, 7250],
 [98, 2132, 8447, 1961, 4068],
 [98, 2132, 8447, 4748, 2161],
 [98, 2132, 8447, 4748, 7450],
 [98, 2132, 8267],
 [98, 2132, 6926, 2015],
 [98, 2132, 7439],
 [98, 2132, 4399],
 [98, 6235, 3712],
 [98, 6235, 4068],
 [98, 6235, 7461],
 [98, 6235, 391, 8121],
 [98, 6235, 391, 8267],
 [98, 6235, 391, 5886],
 [98, 6235, 7439, 6110],
 [98, 6235, 4719, 5886],
 [98, 8287, 5472, 4862],
 [98, 8287, 3362, 8121],
 [98, 8287, 7139, 4850, 8121],
 [98, 8287, 7139, 4850, 1782],
 [98, 8287, 2416, 8121, 1187],
 [98, 8287, 2416, 1657],
 [98, 8287, 4850, 1187, 4577],
 [98, 8287, 4850, 1187, 8121],
 [98, 8287, 4850, 391, 7616, 3344],
 [98, 8287, 4850, 391, 7616, 8121],
 [98, 8287, 4850, 391, 7616, 1782],
 [98, 8287, 4850, 391, 4577, 3344],
 [98, 8287, 4850, 391, 4577, 1782],
 [98, 8287, 6038, 8121],
 [98, 8287, 1594, 1782, 4862, 3902],
 [98, 8287, 1594, 1782, 391, 7616, 3902],
 [98, 8287, 1594, 1782, 391, 4577],
 [98, 8287, 1594, 7953, 1187, 4577, 8059],
 [98, 8287, 1594, 7953, 1187, 8121],
 [98, 8287, 1594, 7953, 8059, 3344, 4577],
 [98, 8287, 1594, 7953, 8059, 3902],
 [98, 8287, 1594, 7953, 391, 7616, 3344],
 [98, 8287, 1594, 7953, 391, 7616, 8121],
 [98, 8287, 1594, 7953, 391, 7616, 3902],
 [98, 8287, 1594, 7953, 391, 4577, 3344],
 [98, 8287, 1594, 4862, 1657],
 [98, 8287, 1594, 1657, 4577],
 [98, 6763, 8447, 2841, 6815],
 [98, 6763, 8447, 2841, 5191],
 [98, 6763, 8447, 7865, 5191],
 [98, 4719, 1098, 2663],
 [98, 4719, 1098, 3902],
 [98, 4719, 1098, 3591],
 [98, 4719, 8415],
 [98, 2161, 4577, 1563],
 [98, 2161, 7139, 4748, 1563],
 [98, 2161, 7139, 4748, 8447, 6815],
 [98, 6263, 4033, 8447],
 [98, 6263, 6018],
 [98, 6263, 6341, 8267],
 [98, 6263, 6341, 2332],
 [98, 6263, 4973],
 [98, 1657, 1098, 2434, 4577, 1594],
 [98, 1657, 1098, 2339, 4577],
 [98, 1657, 1098, 2339, 5534],
 [98, 1657, 1098, 2663],
 [98, 1657, 1098, 2479, 4577, 1594, 5531],
 [98, 1657, 1098, 2479, 4577, 8267],
 [98, 1657, 1098, 2479, 7638, 1594, 5531],
 [98, 1657, 1098, 2479, 7638, 1594, 1373],
 [98, 1657, 1098, 2479, 7638, 5534, 1373],
 [98, 1657, 1098, 4862, 1594, 7638],
 [98, 1657, 4399, 6586],
 [98, 1657, 4399, 2434],
 [98, 1657, 2416, 2339],
 [98, 1657, 2416, 5531],
 [98, 1657, 2416, 1373],
 [98, 1657, 213, 1373, 5534, 2479],
 [98, 1657, 6104, 2434],
 [98, 1657, 6586, 2339],
 [98, 1657, 6586, 8267],
 [98, 1657, 5435, 2434],
 [98, 1657, 5435, 5531, 7638],
 [98, 1149, 7953],
 [98, 1149, 5435, 8415],
 [98, 1149, 2332, 6341],
 [98, 1149, 2332, 8415],
 [98, 6270, 1187, 4850],
 [98, 6270, 1187, 4331],
 [98, 6270, 1187, 2015],
 [98, 6270, 6341, 2434],
 [98, 6270, 6341, 2332],
 [98, 6270, 6341, 4850],
 [98, 6270, 1098, 391, 2434],
 [98, 6270, 1098, 391, 4850, 7616],
 [98, 6270, 1098, 391, 4850, 2479],
 [98, 6270, 1098, 4862],
 [98, 6270, 1098, 8084, 2479],
 [98, 6270, 1098, 2332],
 [98, 6270, 1098, 5534, 2479],
 [98, 6270, 4331, 7616, 391],
 [98, 6270, 6926, 2015],
 [98, 6270, 1683, 391],
 [98, 6270, 2015, 391],
 [98, 3712, 5472],
 [98, 3712, 3591],
 [98, 647, 7661],
 [98, 647, 5983],
 [98, 4748, 1563, 5425],
 [98, 4748, 1563, 7139, 7450],
 [98, 4748, 1563, 1100],
 [98, 4748, 1563, 8501, 5170],
 [98, 4748, 1563, 8501, 7450],
 [98, 4748, 4862],
 [98, 4748, 8447, 5425],
 [98, 4748, 8447, 5170],
 [98, 4748, 8447, 7865],
 [98, 4748, 8447, 6815, 7450, 7139],
 [98, 4748, 8447, 6815, 1100],
 [98, 143, 7890, 1563],
 [98, 1683, 2339, 6110],
 [98, 1683, 2339, 391],
 [98, 1683, 7015],
 [98, 1683, 5425, 1563],
 [98, 1683, 5425, 8447],
 [98, 1683, 5435, 391, 1563, 7890],
 [98, 1683, 5435, 391, 1563, 7450],
 [98, 1683, 5435, 391, 1563, 1782],
 [98, 1683, 5435, 391, 1563, 7306],
 [98, 1683, 5435, 391, 2867, 7890],
 [98, 1683, 5435, 391, 2867, 7450],
 [98, 1683, 5435, 391, 2867, 1782],
 [98, 1683, 5435, 391, 5531],
 [98, 1683, 5435, 8447, 7306, 7865],
 [98, 1683, 5435, 8447, 7306, 6815],
 [98, 1683, 5435, 8447, 2867, 7865, 4068],
 [98, 1683, 5435, 8447, 2867, 7865, 1782],
 [98, 1683, 5435, 8447, 2867, 7450],
 [98, 1683, 5435, 8447, 6815, 7450],
 [98, 1683, 5435, 8447, 6815, 4068],
 [98, 1683, 5435, 8447, 6815, 1782],
 [98, 8343, 6586, 8267],
 [98, 8343, 6586, 3902, 8059],
 [98, 8343, 1098, 8267, 8084],
 [98, 8343, 1098, 1373],
 [98, 8343, 1098, 8059, 8491, 3902],
 [98, 8343, 1098, 8059, 8084],
 [98, 6815, 7139, 8447, 1105],
 [98, 6815, 7139, 8447, 4068],
 [98, 6815, 7139, 8447, 1782],
 [98, 6815, 4973],
 [98, 6815, 7118, 3242, 1105],
 [98, 6815, 7118, 3242, 4419, 2841, 4068],
 [98, 6815, 7118, 3242, 4419, 2841, 7306],
 [98, 6815, 7118, 3242, 4419, 2841, 1100],
 [98, 6815, 7118, 3242, 4419, 2841, 7023],
 [98, 6815, 7118, 3242, 4419, 2841, 1782],
 [98, 6815, 7118, 3242, 4419, 7450],
 [98, 6815, 7118, 2235, 2841],
 [98, 6815, 6228],
 [98, 6815, 5435, 6002, 4419, 4068],
 [98, 6815, 5435, 8415],
 [98, 6815, 5435, 8447, 3242, 1105],
 [98, 6815, 5435, 8447, 3242, 4419, 2841, 4068],
 [98, 6815, 5435, 8447, 3242, 4419, 2841, 7306],
 [98, 6815, 5435, 8447, 3242, 4419, 2841, 1100],
 [98, 6815, 5435, 8447, 3242, 4419, 2841, 7023],
 [98, 6815, 5435, 8447, 3242, 4419, 2841, 1782],
 [98, 6815, 5435, 8447, 3242, 4419, 7450],
 [98, 6815, 5435, 8447, 2235, 2841],
 [98, 1700, 6850, 1373],
 [98, 1700, 6850, 8415],
 [98, 1700, 5983, 1373],
 [98, 2750, 6040],
 [98, 2750, 7890],
 [98, 2750, 2339],
 [98, 213, 7450],
 [98, 213, 2479, 3344],
 [98, 213, 2479, 8491, 5534],
 [98, 4331, 1187, 7953, 1594],
 [98, 4331, 391, 7616, 7953, 1594, 3344],
 [98, 4331, 391, 7616, 7953, 1594, 3902],
 [98, 4331, 391, 4570],
 [98, 4331, 2510, 4861],
 [98, 4331, 7023, 6038],
 [98, 7925, 6586],
 [98, 7925, 7238],
 [98, 4861, 7954],
 [98, 4861, 5534],
 [98, 4862, 4419, 1782],
 [98, 4862, 1098, 1594, 3902, 1782],
 ...]
In [ ]:
for i in range(2,15):
  cliques_gt3 = [x for x in cliques if len(x)>i]
  print(i+1,len(cliques_gt3))
3 38747
4 25502
5 15429
6 8257
7 4172
8 1505
9 450
10 120
11 34
12 8
13 0
14 0
15 0
In [ ]:
cliques_gt3 = [x for x in cliques if len(x)>10]
cliques_gt3
Out[ ]:
[[158, 1286, 1594, 64, 4194, 7616, 8287, 2295, 7953, 7848, 3902],
 [158, 1286, 1594, 64, 4194, 7616, 8287, 2295, 7953, 2986, 3902],
 [158, 1286, 1594, 64, 4194, 7616, 8287, 2295, 7953, 3902, 7715],
 [158, 1286, 1594, 64, 4194, 7616, 8287, 2295, 7953, 2224, 3344],
 [158, 1286, 1594, 64, 4194, 7616, 8287, 2295, 7953, 2224, 7715],
 [158, 1286, 1594, 64, 4194, 7616, 8287, 2295, 7953, 2224, 3887],
 [158, 1286, 1594, 8277, 7616, 4194, 2295, 7953, 8287, 2224, 3344],
 [158, 1286, 1594, 8277, 7616, 4194, 2295, 7953, 8287, 2224, 7715],
 [158, 1286, 1594, 8277, 7616, 4194, 2295, 7953, 8287, 2224, 3887],
 [634, 2283, 7189, 6920, 3041, 7548, 7802, 1755, 4540, 7510, 6679],
 [634, 2283, 7189, 6920, 3041, 7548, 7802, 1755, 4540, 7510, 8375],
 [885, 7802, 6920, 3041, 7548, 2283, 7189, 4607, 1860, 1755, 7510, 2409],
 [885, 7802, 6920, 3041, 7548, 2283, 7189, 4607, 1860, 1755, 7510, 4540],
 [1512, 1594, 64, 1286, 391, 7616, 4194, 8287, 3344, 4037, 2295],
 [1512, 1594, 64, 1286, 391, 7616, 4194, 8287, 8388, 7107, 7848],
 [1512, 1594, 64, 1286, 391, 7616, 4194, 8287, 8388, 7107, 8121],
 [1512, 4850, 4037, 7616, 64, 391, 4194, 8287, 3344, 1286, 2295],
 [1613, 1860, 3041, 7189, 7802, 2409, 7510, 7548, 4607, 2283, 8375],
 [1613, 1860, 3041, 7189, 7802, 2409, 7510, 7548, 4607, 2283, 6679],
 [1755, 7802, 7189, 6920, 1860, 2748, 3041, 4540, 2283, 7548, 4607],
 [1755, 7802, 7189, 6920, 1860, 7510, 3041, 7548, 4607, 2409, 5736],
 [1755, 7802, 7189, 6920, 1860, 7510, 3041, 7548, 4607, 2409, 2283, 6679],
 [1755, 7802, 7189, 6920, 1860, 7510, 3041, 7548, 4607, 2409, 2283, 8375],
 [1755, 7802, 7189, 6920, 1860, 7510, 3041, 7548, 4607, 2409, 7831],
 [1755, 7802, 7189, 6920, 1860, 7510, 3041, 7548, 4607, 4540, 5736],
 [1755, 7802, 7189, 6920, 1860, 7510, 3041, 7548, 4607, 4540, 2283, 8375],
 [1755, 7802, 7189, 6920, 1860, 7510, 3041, 7548, 4607, 4540, 2283, 6679],
 [3902, 7848, 1594, 64, 4194, 391, 7616, 1286, 7953, 8287, 8388],
 [3902, 7848, 1594, 64, 4194, 391, 7616, 1286, 7953, 8287, 2295],
 [3902, 4037, 391, 1594, 64, 7616, 8388, 4194, 8287, 7715, 7953, 1286],
 [3902, 4037, 391, 1594, 64, 7616, 2295, 4194, 8287, 7953, 7715, 1286],
 [7953, 64, 1286, 391, 1594, 4194, 8287, 7616, 3344, 4037, 2295],
 [7953, 64, 1286, 391, 1594, 4194, 8287, 7616, 8388, 7107, 7848],
 [7953, 64, 1286, 391, 1594, 4194, 8287, 7616, 8388, 7107, 8121]]
In [ ]:
nx.density(G_und)
Out[ ]:
0.001908180436634781
In [ ]:
G_und_filtered = G_und.copy()

for u, v, d in G_und.edges(data=True):
    if G_und[u][v]['Score'] < 5:
      G_und_filtered.remove_edge(u, v)

Players who played with each others at least 5 times

In [ ]:
print(nx.info(G_und))
print(nx.info(G_und_filtered))
Name: 
Type: Graph
Number of nodes: 7274
Number of edges: 50475
Average degree:  13.8782
Name: 
Type: Graph
Number of nodes: 7274
Number of edges: 225
Average degree:   0.0619
In [ ]:
new_cliques = list(nx.find_cliques(G_und_filtered))
new_cliques
Out[ ]:
[[1],
 [2],
 [3],
 [4],
 [5],
 [6],
 [7],
 [8],
 [9],
 [10],
 [11],
 [12],
 [13],
 [14],
 [16],
 [17],
 [18],
 [19],
 [21],
 [23],
 [24],
 [25],
 [26],
 [27],
 [29],
 [30],
 [31],
 [32],
 [34],
 [35],
 [36],
 [39],
 [40],
 [42],
 [43],
 [44],
 [45],
 [46],
 [48],
 [49],
 [51],
 [52],
 [53],
 [54],
 [55],
 [56],
 [57],
 [58],
 [59],
 [60],
 [61],
 [62],
 [63],
 [65],
 [66],
 [67],
 [68],
 [69],
 [71],
 [72],
 [73],
 [74],
 [75],
 [76],
 [77],
 [78],
 [79],
 [80],
 [81],
 [82],
 [83],
 [84],
 [85],
 [86],
 [88],
 [89],
 [90],
 [91],
 [92],
 [93],
 [95],
 [96],
 [97],
 [98, 3242, 7306],
 [98, 4171, 7306],
 [98, 4171, 1782],
 [98, 4171, 391],
 [99],
 [101],
 [102],
 [103],
 [104],
 [105],
 [106],
 [107],
 [108],
 [109],
 [110],
 [111],
 [112],
 [113],
 [114],
 [115],
 [118],
 [119],
 [120],
 [121],
 [122],
 [123],
 [125],
 [127],
 [128, 4375],
 [129],
 [131],
 [132],
 [133],
 [134],
 [135],
 [136],
 [138],
 [140],
 [141],
 [142],
 [143],
 [144],
 [145, 4850, 7228],
 [147, 7747],
 [148],
 [149],
 [150],
 [152],
 [153],
 [154],
 [155],
 [156],
 [157],
 [159],
 [160],
 [161],
 [163],
 [165],
 [166],
 [167],
 [168],
 [169],
 [171],
 [172],
 [173],
 [174],
 [175],
 [176],
 [177],
 [178],
 [179],
 [180, 3386],
 [181],
 [183],
 [184],
 [187, 392],
 [188],
 [189],
 [191],
 [192],
 [193, 6018],
 [194],
 [195],
 [196],
 [197],
 [198],
 [199],
 [200],
 [201],
 [202],
 [203],
 [204],
 [205],
 [206],
 [207],
 [208],
 [209],
 [212],
 [213],
 [214],
 [215],
 [216],
 [217],
 [218],
 [219],
 [220],
 [221],
 [222],
 [223],
 [224],
 [225],
 [226, 5380],
 [227],
 [228],
 [230],
 [231],
 [232],
 [233],
 [234],
 [235],
 [236],
 [237],
 [238],
 [239],
 [240],
 [241],
 [242],
 [243, 2035],
 [244],
 [246],
 [247],
 [248],
 [249],
 [250],
 [251],
 [252],
 [253],
 [254],
 [256],
 [258],
 [260],
 [261],
 [262],
 [263],
 [265],
 [268],
 [269],
 [271],
 [272],
 [273],
 [274],
 [275],
 [276],
 [277],
 [279],
 [280],
 [281],
 [282],
 [283],
 [284],
 [285],
 [286],
 [287],
 [288],
 [289],
 [290],
 [292],
 [293],
 [295],
 [296],
 [297],
 [299],
 [300],
 [301],
 [302],
 [304],
 [306],
 [307],
 [308],
 [309],
 [310],
 [311],
 [312],
 [313],
 [314],
 [315],
 [316],
 [317],
 [318],
 [319],
 [320],
 [321],
 [322],
 [323],
 [324],
 [326],
 [327],
 [328],
 [329],
 [330],
 [331],
 [332],
 [333],
 [334],
 [335],
 [336],
 [337],
 [339],
 [341],
 [342],
 [343],
 [344],
 [345],
 [346],
 [347],
 [349, 3523],
 [351],
 [352],
 [355],
 [356],
 [357],
 [358],
 [359],
 [360],
 [361],
 [363],
 [364],
 [365],
 [367],
 [370],
 [371],
 [372],
 [373],
 [374],
 [375],
 [376],
 [377],
 [379],
 [380],
 [382],
 [383],
 [384],
 [385],
 [386, 4931],
 [386, 391],
 [388],
 [389],
 [390],
 [393],
 [394],
 [395],
 [397],
 [398],
 [399],
 [400],
 [402],
 [403],
 [404],
 [405],
 [406],
 [408, 5983],
 [409],
 [410],
 [411],
 [413],
 [414],
 [416],
 [418],
 [419],
 [420],
 [421],
 [422],
 [423],
 [424],
 [425],
 [426],
 [428],
 [429],
 [430],
 [431],
 [432],
 [433],
 [436],
 [437],
 [438],
 [440],
 [441],
 [443],
 [444],
 [445],
 [447],
 [448],
 [450, 8337],
 [450, 2132],
 [451],
 [452],
 [453],
 [454],
 [456],
 [457],
 [458],
 [459],
 [460],
 [462],
 [463],
 [464],
 [465],
 [466, 6339],
 [467],
 [468],
 [469],
 [470],
 [471],
 [473],
 [474],
 [475],
 [476],
 [477],
 [478],
 [479],
 [480],
 [481],
 [483],
 [484],
 [485],
 [486],
 [488],
 [489],
 [490],
 [491],
 [492],
 [493],
 [494],
 [495],
 [496],
 [497],
 [498],
 [500],
 [501],
 [502],
 [503],
 [504],
 [505],
 [506],
 [507],
 [508],
 [510],
 [512],
 [513],
 [514],
 [515],
 [517],
 [518],
 [519],
 [520],
 [521],
 [522],
 [523],
 [524],
 [525],
 [526],
 [527],
 [529],
 [530],
 [531],
 [532],
 [534],
 [536],
 [537],
 [538],
 [539],
 [540],
 [542],
 [543],
 [544],
 [545],
 [546],
 [547],
 [548],
 [549],
 [550],
 [551],
 [552],
 [553],
 [554],
 [555],
 [556],
 [557],
 [558],
 [559],
 [560],
 [561],
 [562],
 [563],
 [564],
 [565],
 [566],
 [567],
 [568],
 [569],
 [570],
 [571],
 [572],
 [573],
 [575],
 [577],
 [578],
 [579],
 [580],
 [581],
 [582],
 [583],
 [584],
 [585],
 [586],
 [587],
 [588, 2231],
 [589],
 [590],
 [591],
 [592],
 [593],
 [594],
 [595],
 [596, 4162],
 [598],
 [599],
 [600],
 [601],
 [603],
 [605],
 [607],
 [608],
 [609],
 [610],
 [611],
 [612],
 [614],
 [615],
 [616],
 [617],
 [618],
 [619],
 [620],
 [621],
 [623],
 [624],
 [625],
 [626],
 [627],
 [628],
 [629],
 [631],
 [632],
 [633],
 [634],
 [635],
 [636],
 [638, 5417],
 [639],
 [641],
 [642],
 [643],
 [644],
 [645],
 [646],
 [647],
 [648],
 [649],
 [650],
 [651],
 [652],
 [653],
 [654],
 [657],
 [658],
 [659],
 [660],
 [661],
 [662],
 [663],
 [664],
 [665],
 [667],
 [668],
 [670],
 [671],
 [672],
 [673],
 [674],
 [675, 2599],
 [676],
 [677],
 [679],
 [680],
 [681],
 [682],
 [683],
 [684],
 [685],
 [686],
 [687],
 [689],
 [690, 3909],
 [691],
 [693],
 [695],
 [697],
 [698],
 [699, 2362],
 [699, 3523],
 [699, 2581],
 [700],
 [701],
 [703],
 [704],
 [705],
 [706],
 [707],
 [708],
 [709],
 [710],
 [711],
 [712],
 [713],
 [714],
 [715],
 [716],
 [718],
 [719],
 [720],
 [721],
 [722],
 [723],
 [724],
 [725],
 [726],
 [727],
 [728],
 [729],
 [730],
 [731],
 [732],
 [733],
 [735],
 [736],
 [737],
 [738],
 [739],
 [740],
 [741],
 [742],
 [743],
 [744],
 [746],
 [747],
 [748],
 [749],
 [750],
 [751],
 [753],
 [754],
 [755],
 [757],
 [758],
 [759],
 [760],
 [761],
 [762],
 [763],
 [765],
 [766],
 [767],
 [768],
 [769],
 [770],
 [771],
 [772],
 [773],
 [774],
 [775],
 [776],
 [778],
 [779],
 [780],
 [781],
 [782],
 [783],
 [785],
 [786],
 [787],
 [788],
 [790],
 [791],
 [793],
 [794],
 [795],
 [796],
 [797],
 [798],
 [799],
 [800],
 [801],
 [803],
 [804],
 [805],
 [806],
 [807],
 [808],
 [809],
 [810],
 [811],
 [812],
 [813],
 [814],
 [817],
 [818],
 [819],
 [820],
 [823],
 [825],
 [826],
 [827],
 [828],
 [829],
 [830],
 [831],
 [832],
 [833],
 [834],
 [835],
 [837],
 [838],
 [839],
 [840],
 [841],
 [842],
 [843],
 [844],
 [845],
 [846],
 [848],
 [849],
 [850],
 [851],
 [853],
 [856],
 [858],
 [859],
 [860],
 [861],
 [862],
 [863],
 [864],
 [865],
 [867],
 [868],
 [869],
 [870],
 [871],
 [872],
 [873],
 [874],
 [875],
 [876],
 [877],
 [878],
 [879],
 [881],
 [883],
 [884],
 [885],
 [886],
 [887],
 [888],
 [889],
 [890],
 [892],
 [893],
 [894],
 [895, 4162, 898],
 [897],
 [899],
 [900],
 [901],
 [902],
 [903],
 [904],
 [906],
 [908],
 [909],
 [910],
 [911],
 [913],
 [914],
 [916],
 [917],
 [918],
 [920],
 [921],
 [922],
 [923],
 [924],
 [925],
 [926],
 [927],
 [928],
 [929],
 [930],
 [931],
 [933],
 [934],
 [935],
 [936],
 [937],
 [938],
 [939],
 [940],
 [941],
 [942],
 [943, 4484],
 [944],
 [945],
 [946],
 [947],
 [948],
 [949],
 [951],
 [952],
 [954],
 [955],
 [956],
 [957],
 [958],
 [960],
 [962],
 [963],
 [964],
 [965],
 [966],
 [967],
 [968],
 [969],
 [971, 8152, 6850],
 [971, 7447],
 [972],
 [973],
 [974],
 [975],
 [976],
 [977],
 [978],
 [979],
 [980],
 [981],
 [982],
 [983],
 [984],
 [985],
 [986],
 [990],
 [991],
 [992],
 [993],
 [994],
 [996],
 [998],
 [999],
 [1000],
 [1001],
 [1002],
 [1003],
 [1004],
 [1005],
 [1006],
 [1008],
 [1010],
 [1011],
 [1012],
 [1013],
 [1016],
 [1017],
 [1018],
 [1019],
 [1020],
 [1021],
 [1023],
 [1024],
 [1025],
 [1027],
 [1028],
 [1029],
 [1030],
 [1031],
 [1032],
 [1033],
 [1034],
 [1035],
 [1036],
 [1037],
 [1038],
 [1039],
 [1040],
 [1041],
 [1042],
 [1043],
 [1044],
 [1045],
 [1046],
 [1047],
 [1048],
 [1049],
 [1050],
 [1051],
 [1052],
 [1053],
 [1054],
 [1055],
 [1056],
 [1057],
 [1058],
 [1059],
 [1060],
 [1061],
 [1062],
 [1063],
 [1064],
 [1065],
 [1066],
 [1067],
 [1068],
 [1069],
 [1070],
 [1072],
 [1074],
 [1075],
 [1076],
 [1077],
 [1078],
 [1079],
 [1080],
 [1081],
 [1082],
 [1083],
 [1084],
 [1086],
 [1087],
 [1089],
 [1090],
 [1091],
 [1092],
 [1093],
 [1094],
 [1095],
 [1096],
 [1097],
 [1098, 8343],
 [1098, 8388],
 [1098, 4679],
 [1099],
 [1100, 7518],
 [1100, 6815],
 [1101],
 [1102],
 [1104],
 [1105],
 [1106],
 [1107],
 [1108],
 [1109],
 [1110],
 [1111],
 [1112],
 [1114],
 [1115],
 [1116],
 [1117],
 [1118],
 [1119],
 [1120],
 [1121],
 [1122],
 [1123],
 [1124],
 [1125],
 [1126, 2362, 7719],
 [1126, 4628],
 [1127],
 [1128],
 [1129],
 [1130],
 [1132],
 [1133],
 [1134],
 [1135],
 [1136],
 [1137],
 [1139],
 [1140],
 [1141],
 [1142],
 [1143],
 [1144],
 [1145],
 [1146],
 [1147],
 [1148],
 [1149],
 [1150],
 [1151],
 [1152],
 [1153],
 [1154],
 [1155],
 [1156],
 [1157],
 [1158],
 ...]
In [ ]:
for i in range(2,15):
  cliques_gt3 = [x for x in new_cliques if len(x)>i]
  print(i+1,len(cliques_gt3))
3 41
4 15
5 3
6 0
7 0
8 0
9 0
10 0
11 0
12 0
13 0
14 0
15 0

41 3 cliques who at least played with each player at least 5 times

In [ ]:
new_cliques_gt3 = [x for x in new_cliques if len(x)>3]
new_cliques_gt3
Out[ ]:
[[1286, 8287, 64, 7848],
 [1286, 8287, 64, 1594],
 [2295, 64, 7953, 7848],
 [2295, 64, 158, 7848],
 [2295, 64, 158, 3344],
 [2295, 64, 158, 1594],
 [4194, 64, 7953, 7848],
 [4194, 64, 158, 7848],
 [4194, 64, 158, 3344],
 [4194, 64, 158, 1594, 7715],
 [4194, 7616, 158, 7848],
 [4194, 7616, 158, 3344],
 [4194, 7616, 158, 1594, 7715],
 [8287, 64, 158, 7848],
 [8287, 64, 158, 1594, 7715]]
In [ ]:
nx.is_weakly_connected(G)
Out[ ]:
False
In [ ]:
nx.is_connected(G_und)
Out[ ]:
False
In [ ]:
all_components = list(nx.connected_components(G_und))
all_components
Out[ ]:
[{1,
  2,
  3,
  4,
  5,
  6,
  7,
  8,
  9,
  10,
  11,
  12,
  13,
  14,
  16,
  17,
  18,
  19,
  21,
  23,
  24,
  25,
  26,
  27,
  29,
  30,
  31,
  32,
  34,
  35,
  36,
  39,
  40,
  42,
  43,
  44,
  45,
  46,
  48,
  49,
  51,
  52,
  53,
  54,
  55,
  56,
  57,
  58,
  59,
  60,
  61,
  63,
  64,
  65,
  66,
  67,
  68,
  69,
  71,
  72,
  73,
  74,
  75,
  76,
  77,
  78,
  79,
  80,
  82,
  83,
  84,
  85,
  86,
  88,
  89,
  92,
  95,
  96,
  97,
  98,
  99,
  101,
  102,
  103,
  105,
  106,
  107,
  108,
  109,
  110,
  111,
  112,
  113,
  114,
  115,
  118,
  119,
  120,
  121,
  122,
  125,
  127,
  128,
  129,
  131,
  132,
  133,
  134,
  135,
  136,
  138,
  140,
  141,
  142,
  143,
  144,
  145,
  147,
  148,
  149,
  150,
  152,
  153,
  154,
  155,
  156,
  157,
  158,
  159,
  160,
  161,
  163,
  165,
  166,
  167,
  168,
  169,
  171,
  172,
  173,
  174,
  175,
  176,
  177,
  178,
  179,
  180,
  181,
  183,
  184,
  187,
  188,
  189,
  191,
  192,
  193,
  194,
  195,
  196,
  197,
  198,
  199,
  200,
  201,
  202,
  204,
  205,
  206,
  207,
  208,
  209,
  212,
  213,
  214,
  215,
  216,
  217,
  218,
  219,
  220,
  221,
  222,
  223,
  224,
  226,
  227,
  228,
  230,
  231,
  232,
  233,
  234,
  235,
  236,
  237,
  238,
  239,
  240,
  241,
  242,
  243,
  244,
  246,
  247,
  249,
  251,
  252,
  253,
  254,
  256,
  260,
  261,
  262,
  263,
  265,
  268,
  269,
  271,
  272,
  273,
  274,
  275,
  276,
  277,
  279,
  280,
  281,
  282,
  283,
  284,
  285,
  286,
  287,
  288,
  289,
  290,
  292,
  293,
  295,
  296,
  299,
  300,
  301,
  302,
  304,
  306,
  307,
  308,
  309,
  310,
  311,
  312,
  313,
  314,
  315,
  316,
  317,
  318,
  319,
  320,
  321,
  322,
  323,
  324,
  326,
  327,
  328,
  329,
  330,
  331,
  332,
  333,
  334,
  335,
  336,
  337,
  339,
  341,
  342,
  343,
  344,
  345,
  346,
  347,
  349,
  352,
  355,
  356,
  357,
  358,
  359,
  360,
  361,
  363,
  364,
  365,
  367,
  370,
  371,
  372,
  373,
  374,
  375,
  376,
  377,
  379,
  380,
  382,
  383,
  384,
  385,
  386,
  388,
  389,
  390,
  391,
  392,
  393,
  394,
  395,
  397,
  398,
  399,
  400,
  402,
  403,
  404,
  405,
  406,
  408,
  409,
  410,
  411,
  413,
  414,
  416,
  418,
  419,
  420,
  421,
  422,
  423,
  424,
  425,
  426,
  428,
  429,
  430,
  431,
  432,
  433,
  436,
  437,
  438,
  440,
  441,
  443,
  444,
  445,
  447,
  448,
  450,
  451,
  452,
  453,
  454,
  456,
  457,
  458,
  460,
  462,
  463,
  464,
  465,
  466,
  467,
  468,
  469,
  470,
  471,
  473,
  474,
  475,
  476,
  477,
  478,
  479,
  480,
  481,
  483,
  484,
  485,
  486,
  488,
  489,
  490,
  491,
  492,
  493,
  494,
  495,
  497,
  498,
  501,
  502,
  503,
  504,
  505,
  506,
  507,
  508,
  512,
  513,
  514,
  515,
  517,
  518,
  519,
  520,
  521,
  522,
  523,
  524,
  525,
  526,
  527,
  529,
  530,
  531,
  532,
  534,
  536,
  537,
  538,
  539,
  540,
  543,
  544,
  545,
  546,
  547,
  548,
  549,
  550,
  551,
  552,
  553,
  554,
  555,
  556,
  557,
  558,
  559,
  560,
  561,
  562,
  563,
  565,
  566,
  567,
  568,
  569,
  570,
  571,
  572,
  573,
  575,
  577,
  579,
  580,
  581,
  582,
  583,
  584,
  585,
  586,
  587,
  588,
  589,
  590,
  591,
  592,
  593,
  594,
  595,
  596,
  598,
  599,
  600,
  601,
  603,
  605,
  607,
  608,
  609,
  610,
  611,
  612,
  614,
  615,
  616,
  617,
  618,
  619,
  620,
  621,
  623,
  624,
  625,
  626,
  627,
  628,
  629,
  631,
  632,
  634,
  635,
  636,
  638,
  639,
  641,
  642,
  643,
  644,
  645,
  646,
  647,
  648,
  649,
  650,
  651,
  652,
  653,
  654,
  657,
  658,
  659,
  660,
  661,
  662,
  663,
  664,
  665,
  667,
  668,
  670,
  671,
  672,
  673,
  674,
  675,
  676,
  677,
  679,
  680,
  681,
  683,
  684,
  685,
  686,
  687,
  689,
  690,
  691,
  693,
  695,
  698,
  699,
  700,
  701,
  703,
  704,
  705,
  706,
  708,
  709,
  710,
  712,
  713,
  714,
  715,
  716,
  718,
  719,
  720,
  721,
  722,
  723,
  724,
  725,
  726,
  727,
  728,
  729,
  730,
  731,
  732,
  733,
  735,
  736,
  737,
  738,
  739,
  740,
  741,
  742,
  743,
  744,
  746,
  747,
  748,
  749,
  750,
  751,
  753,
  754,
  755,
  757,
  758,
  759,
  760,
  761,
  762,
  763,
  765,
  766,
  767,
  768,
  769,
  770,
  771,
  772,
  773,
  774,
  775,
  776,
  778,
  779,
  780,
  781,
  782,
  783,
  785,
  786,
  787,
  788,
  790,
  791,
  793,
  795,
  796,
  797,
  798,
  799,
  800,
  801,
  803,
  804,
  805,
  806,
  807,
  808,
  809,
  810,
  811,
  812,
  813,
  814,
  817,
  818,
  819,
  820,
  823,
  825,
  826,
  827,
  828,
  829,
  830,
  831,
  832,
  833,
  834,
  835,
  837,
  838,
  840,
  841,
  842,
  843,
  844,
  845,
  846,
  848,
  849,
  850,
  851,
  853,
  856,
  858,
  859,
  860,
  861,
  862,
  863,
  864,
  865,
  867,
  868,
  869,
  870,
  871,
  872,
  873,
  874,
  875,
  876,
  877,
  878,
  879,
  881,
  883,
  884,
  885,
  886,
  887,
  888,
  889,
  890,
  892,
  893,
  894,
  895,
  897,
  898,
  899,
  900,
  901,
  902,
  903,
  904,
  906,
  908,
  910,
  911,
  913,
  914,
  916,
  917,
  918,
  920,
  921,
  922,
  923,
  924,
  925,
  926,
  927,
  928,
  929,
  933,
  934,
  935,
  936,
  937,
  938,
  939,
  940,
  941,
  942,
  943,
  944,
  945,
  946,
  947,
  948,
  949,
  951,
  952,
  954,
  955,
  956,
  957,
  958,
  960,
  962,
  963,
  964,
  965,
  966,
  967,
  968,
  969,
  971,
  972,
  973,
  974,
  975,
  976,
  977,
  978,
  979,
  980,
  981,
  982,
  983,
  984,
  985,
  986,
  990,
  991,
  992,
  993,
  994,
  996,
  998,
  999,
  1000,
  1001,
  1002,
  1003,
  1004,
  1005,
  1006,
  1008,
  1010,
  1011,
  1012,
  1013,
  1016,
  1017,
  1018,
  1019,
  1020,
  1021,
  1023,
  1024,
  1025,
  1027,
  1028,
  1029,
  1030,
  1031,
  1032,
  1033,
  1034,
  1035,
  1036,
  1037,
  1038,
  1039,
  1040,
  1041,
  1042,
  1043,
  1044,
  1045,
  1047,
  1048,
  1049,
  1050,
  1051,
  1052,
  1053,
  1054,
  1055,
  1056,
  1057,
  1058,
  1059,
  1060,
  1061,
  1062,
  1063,
  1064,
  1065,
  1066,
  1067,
  1068,
  1069,
  1070,
  1072,
  1074,
  1075,
  1076,
  1077,
  1078,
  1079,
  1080,
  1081,
  1082,
  1083,
  1084,
  1086,
  1087,
  1089,
  1090,
  1091,
  1092,
  1093,
  1094,
  1095,
  1096,
  1097,
  1098,
  1099,
  1100,
  1101,
  1102,
  1104,
  1105,
  1106,
  1107,
  1108,
  1109,
  1110,
  1111,
  1112,
  1114,
  1115,
  1116,
  1117,
  1118,
  1119,
  1120,
  1121,
  1122,
  1123,
  1124,
  1125,
  1126,
  1127,
  1128,
  1129,
  1130,
  1132,
  1133,
  1134,
  1135,
  1136,
  1137,
  1139,
  1140,
  1141,
  1142,
  1143,
  1144,
  1145,
  1146,
  1147,
  1148,
  1149,
  1150,
  1151,
  1152,
  1153,
  1154,
  1155,
  1156,
  1157,
  1158,
  1159,
  1161,
  1162,
  1163,
  1164,
  1165,
  1166,
  1169,
  1170,
  1172,
  1175,
  1176,
  1177,
  1178,
  1179,
  1180,
  1182,
  1183,
  1184,
  1185,
  1186,
  1187,
  1188,
  1189,
  1190,
  1191,
  1192,
  1194,
  1195,
  1196,
  1198,
  1200,
  1202,
  1203,
  1204,
  1205,
  1207,
  1209,
  1210,
  ...},
 {62, 81, 4345, 4407, 4715, 7929},
 {93, 1491},
 {203, 8065},
 {225, 258},
 {250, 6264},
 {542, 5507},
 {564, 711, 1448, 2133, 7105, 8314, 8336},
 {578, 3996},
 {682, 4475, 6180},
 {697, 5818},
 {794, 5390, 5400},
 {909, 2425, 4210, 5246, 6465},
 {839, 930},
 {1046, 7622},
 {1174, 7894},
 {1266, 2608, 3559},
 {1398, 1504},
 {1590, 6415},
 {1646, 1887},
 {1664, 1935, 3993},
 {90, 1769},
 {1817, 2193, 7838, 8521},
 {1993, 6684},
 {2054, 4667},
 {2113, 4594},
 {2367, 6700},
 {2370, 4941},
 {2371, 3524, 7240},
 {248, 2423},
 {1414, 2681, 4298, 4305},
 {2944, 5793},
 {2968, 3627},
 {633, 3021, 3611, 4386},
 {3080, 4239},
 {2604, 3192},
 {3211, 4052, 8596},
 {1796, 1948, 3308},
 {3721, 4362},
 {3854, 4984},
 {104, 3926},
 {3960, 4000, 6145, 6722},
 {2274, 3964},
 {2547, 4141},
 {4205, 4623, 5968, 6163, 6377},
 {4221, 8579},
 {4264, 6976},
 {1208, 4380},
 {2945, 4449},
 {1341, 4527, 6457},
 {4539, 4795},
 {931, 4780},
 {4884, 5982, 7231},
 {4299, 5130},
 {4360, 5139},
 {3939, 5147},
 {1429, 5161},
 {3460, 5628},
 {3154, 5637},
 {5669, 6928},
 {5723, 7775},
 {3942, 5881},
 {4655, 6070},
 {6082, 7923},
 {3252, 6083},
 {6293, 7903},
 {2736, 6352},
 {5383, 6397},
 {496, 6423},
 {707, 6453},
 {351, 6464},
 {6547, 7500},
 {500, 6596},
 {1489, 6682},
 {297, 6689},
 {6807, 7293},
 {91, 6942},
 {510, 7028},
 {7275, 7333},
 {4248, 7409},
 {459, 7544},
 {123, 7820},
 {3138, 7918},
 {6732, 8102},
 {4230, 8105, 8257},
 {3651, 8113},
 {4395, 8432}]
In [ ]:
all_comp_sorted = sorted(nx.connected_components(G_und), key=len, reverse=True)
G_und_lcc = G_und.subgraph(all_comp_sorted[0])
print(nx.info(G_und_lcc))
Name: 
Type: Graph
Number of nodes: 7069
Number of edges: 50348
Average degree:  14.2447
In [ ]:
print(nx.info(G_und))
print(nx.info(G_und_lcc))
Name: 
Type: Graph
Number of nodes: 7274
Number of edges: 50475
Average degree:  13.8782
Name: 
Type: Graph
Number of nodes: 7069
Number of edges: 50348
Average degree:  14.2447
In [ ]:
nx.diameter(G_und_lcc)
Out[ ]:
13
In [ ]:
print(nx.average_shortest_path_length(G_und_lcc))
4.088817535741755
In [ ]:
nx.density(G_und_lcc)
Out[ ]:
0.0020153834908757345
In [ ]:
print("avarage clustering: ", nx.average_clustering(G_und_lcc))
avarage clustering:  0.16229148018580436
In [ ]:
print("avarage clustering: ", nx.average_clustering(G_und))
avarage clustering:  0.1588633223490217
In [ ]:
print(nx.transitivity(G_und_lcc))
0.11507032641535152
In [ ]:
print(nx.transitivity(G_und))
0.11507886244231257
In [ ]:
from networkx.algorithms import community as nxcomm
In [ ]:
kl_res = nxcomm.kernighan_lin_bisection(G_und, weight = 'Score')
kl_res
Out[ ]:
({8192,
  1,
  8194,
  4,
  5,
  8199,
  10,
  11,
  12,
  13,
  8206,
  8204,
  8208,
  16,
  18,
  8211,
  19,
  8215,
  26,
  8219,
  8220,
  8221,
  8223,
  32,
  8224,
  34,
  8227,
  8229,
  8232,
  8234,
  8235,
  8236,
  45,
  46,
  43,
  48,
  44,
  8243,
  52,
  8245,
  8246,
  55,
  8248,
  53,
  57,
  58,
  8251,
  61,
  62,
  63,
  8256,
  8257,
  66,
  67,
  8258,
  64,
  71,
  72,
  8265,
  74,
  8267,
  76,
  8271,
  8272,
  8273,
  80,
  83,
  8275,
  8277,
  79,
  86,
  8282,
  8283,
  96,
  97,
  8289,
  99,
  98,
  8293,
  8288,
  8292,
  8296,
  104,
  8298,
  105,
  108,
  109,
  102,
  8303,
  8304,
  8305,
  114,
  113,
  8308,
  8309,
  118,
  119,
  120,
  121,
  8313,
  8311,
  8317,
  125,
  8318,
  128,
  8319,
  8323,
  133,
  8326,
  8327,
  135,
  136,
  8330,
  8331,
  140,
  134,
  142,
  8334,
  8336,
  143,
  148,
  149,
  8342,
  8343,
  152,
  8344,
  153,
  155,
  154,
  156,
  8350,
  157,
  8352,
  161,
  8354,
  160,
  8356,
  165,
  169,
  8361,
  8363,
  8365,
  8366,
  8367,
  176,
  8368,
  8370,
  178,
  8373,
  8374,
  183,
  8379,
  8380,
  8381,
  8382,
  191,
  8384,
  192,
  8386,
  195,
  8387,
  197,
  198,
  199,
  200,
  8388,
  202,
  8395,
  8396,
  8390,
  206,
  203,
  8400,
  8401,
  209,
  212,
  215,
  8408,
  217,
  8410,
  216,
  8412,
  218,
  8407,
  223,
  8409,
  225,
  8417,
  8419,
  228,
  8421,
  230,
  8423,
  8424,
  232,
  8426,
  226,
  236,
  237,
  238,
  239,
  240,
  241,
  8433,
  243,
  244,
  8432,
  8438,
  8436,
  249,
  252,
  8445,
  254,
  8447,
  256,
  8449,
  258,
  8448,
  8452,
  261,
  8454,
  8455,
  263,
  8457,
  265,
  8459,
  260,
  269,
  8462,
  8463,
  8465,
  274,
  275,
  279,
  282,
  8476,
  285,
  8478,
  8479,
  8480,
  289,
  8477,
  295,
  8488,
  297,
  296,
  299,
  300,
  8493,
  301,
  302,
  304,
  8496,
  8498,
  8491,
  8500,
  8501,
  310,
  311,
  312,
  8504,
  314,
  8506,
  8505,
  317,
  8508,
  8511,
  8512,
  321,
  322,
  8514,
  319,
  323,
  324,
  327,
  8520,
  8518,
  330,
  326,
  8524,
  334,
  336,
  8528,
  8531,
  8533,
  342,
  8535,
  8536,
  8534,
  8539,
  8540,
  351,
  352,
  8545,
  8546,
  355,
  357,
  360,
  361,
  8554,
  8555,
  8556,
  363,
  365,
  8560,
  8561,
  370,
  373,
  8566,
  8567,
  8568,
  380,
  8572,
  382,
  384,
  8577,
  8578,
  386,
  8579,
  389,
  385,
  391,
  395,
  8588,
  8589,
  8590,
  399,
  400,
  8594,
  8595,
  8596,
  405,
  403,
  8599,
  408,
  406,
  8602,
  411,
  8600,
  8605,
  413,
  8607,
  8609,
  418,
  420,
  421,
  422,
  8615,
  8617,
  8618,
  8619,
  8620,
  429,
  430,
  8622,
  8624,
  432,
  8626,
  433,
  436,
  8628,
  8630,
  8625,
  440,
  8629,
  8631,
  8627,
  444,
  447,
  448,
  450,
  454,
  456,
  462,
  463,
  464,
  465,
  468,
  471,
  473,
  474,
  476,
  477,
  478,
  479,
  480,
  485,
  488,
  489,
  490,
  492,
  495,
  496,
  497,
  503,
  504,
  508,
  512,
  517,
  518,
  519,
  520,
  525,
  526,
  527,
  531,
  532,
  534,
  537,
  540,
  544,
  546,
  548,
  549,
  550,
  551,
  553,
  554,
  555,
  557,
  558,
  561,
  569,
  571,
  575,
  577,
  578,
  579,
  580,
  582,
  583,
  584,
  585,
  586,
  587,
  588,
  592,
  603,
  605,
  607,
  608,
  609,
  610,
  611,
  615,
  616,
  618,
  619,
  620,
  624,
  625,
  626,
  627,
  628,
  629,
  634,
  636,
  639,
  641,
  644,
  646,
  648,
  650,
  651,
  652,
  654,
  660,
  663,
  664,
  667,
  670,
  671,
  673,
  676,
  679,
  681,
  682,
  683,
  685,
  686,
  689,
  690,
  691,
  693,
  697,
  700,
  710,
  711,
  714,
  718,
  719,
  720,
  722,
  724,
  725,
  729,
  730,
  731,
  732,
  736,
  737,
  739,
  741,
  744,
  750,
  751,
  754,
  759,
  760,
  761,
  763,
  770,
  776,
  778,
  779,
  780,
  781,
  782,
  785,
  786,
  788,
  790,
  791,
  795,
  798,
  801,
  803,
  806,
  807,
  808,
  811,
  813,
  814,
  818,
  820,
  826,
  827,
  828,
  829,
  831,
  834,
  835,
  837,
  838,
  839,
  842,
  843,
  849,
  851,
  856,
  860,
  864,
  865,
  869,
  870,
  873,
  875,
  881,
  885,
  886,
  887,
  888,
  894,
  898,
  901,
  903,
  906,
  910,
  916,
  918,
  921,
  922,
  924,
  925,
  929,
  930,
  933,
  934,
  936,
  940,
  945,
  946,
  947,
  949,
  955,
  960,
  964,
  965,
  966,
  968,
  975,
  979,
  981,
  983,
  986,
  990,
  991,
  992,
  994,
  999,
  1001,
  1004,
  8341,
  1012,
  201,
  1016,
  1018,
  1019,
  1020,
  1023,
  1024,
  1025,
  1029,
  1030,
  1033,
  1034,
  1036,
  1038,
  1041,
  1044,
  1046,
  1047,
  1048,
  1050,
  1051,
  1053,
  1055,
  1062,
  1064,
  1066,
  1068,
  1076,
  1077,
  1080,
  1082,
  1084,
  1086,
  1087,
  1089,
  1090,
  1091,
  1093,
  1094,
  1096,
  1099,
  1100,
  1101,
  1102,
  1110,
  1112,
  221,
  1115,
  1116,
  1117,
  1118,
  1119,
  1120,
  1121,
  1127,
  1128,
  1130,
  1133,
  1134,
  1136,
  1139,
  1140,
  1141,
  1142,
  1143,
  1145,
  1152,
  1156,
  1159,
  1161,
  1165,
  1169,
  1170,
  1174,
  1175,
  1178,
  1180,
  1182,
  1185,
  1190,
  1191,
  1192,
  1194,
  1195,
  1196,
  1198,
  1200,
  1208,
  1209,
  1210,
  1211,
  1213,
  1214,
  1218,
  1221,
  1222,
  1223,
  1225,
  1226,
  1228,
  1232,
  1234,
  1235,
  1241,
  1246,
  1249,
  1251,
  1254,
  1256,
  1259,
  1261,
  1262,
  8392,
  1265,
  1266,
  1269,
  1272,
  1273,
  1278,
  1280,
  1281,
  1286,
  1288,
  1291,
  1292,
  1294,
  1295,
  1296,
  1301,
  1302,
  1304,
  1306,
  1307,
  1311,
  1312,
  1313,
  1315,
  1319,
  1320,
  1321,
  1324,
  1325,
  1326,
  1327,
  1329,
  1331,
  1333,
  1334,
  1337,
  1338,
  1340,
  1342,
  1343,
  1346,
  1348,
  1349,
  1353,
  1357,
  1358,
  1360,
  1361,
  1362,
  1365,
  1367,
  1372,
  1374,
  1375,
  1376,
  1377,
  8415,
  1379,
  1380,
  1382,
  1388,
  1390,
  1391,
  1397,
  1400,
  1401,
  1403,
  1404,
  1405,
  1408,
  1410,
  1411,
  1412,
  1413,
  1414,
  1420,
  1425,
  1430,
  1431,
  1434,
  1435,
  1439,
  1445,
  1448,
  1453,
  1456,
  1458,
  1462,
  1463,
  1465,
  1466,
  1469,
  1476,
  1477,
  1478,
  1484,
  1485,
  1489,
  1490,
  1492,
  1497,
  1499,
  1503,
  1504,
  1505,
  1515,
  1517,
  1519,
  1521,
  1522,
  1524,
  1526,
  1528,
  1530,
  1533,
  1536,
  1539,
  1540,
  1541,
  1544,
  8202,
  1550,
  1551,
  1557,
  1558,
  1561,
  1563,
  1564,
  1570,
  1573,
  1574,
  1576,
  1577,
  1581,
  1584,
  1593,
  1595,
  1596,
  1598,
  1599,
  1604,
  1611,
  1612,
  1616,
  1623,
  1624,
  1626,
  1627,
  1629,
  1632,
  1635,
  1636,
  1637,
  1638,
  1639,
  1640,
  1645,
  1650,
  1652,
  1653,
  1655,
  1656,
  1661,
  1662,
  1666,
  1667,
  1668,
  1674,
  1675,
  1678,
  1681,
  1685,
  1686,
  1695,
  1697,
  1698,
  1699,
  1700,
  1702,
  1703,
  1706,
  1707,
  1708,
  1710,
  1712,
  1714,
  1715,
  1719,
  1724,
  1725,
  1726,
  1727,
  1729,
  1731,
  1735,
  1736,
  1738,
  1740,
  1744,
  1745,
  1746,
  1750,
  1756,
  1757,
  1758,
  1759,
  1761,
  1764,
  1769,
  1772,
  1773,
  1776,
  1777,
  1781,
  1782,
  1785,
  1786,
  1787,
  1788,
  1790,
  1791,
  1795,
  1799,
  1804,
  1810,
  1823,
  1824,
  1826,
  1827,
  1828,
  1829,
  1830,
  1831,
  1832,
  1833,
  1836,
  1837,
  1840,
  8507,
  1846,
  1850,
  1854,
  1855,
  1856,
  1860,
  1863,
  1866,
  1869,
  1870,
  1871,
  1872,
  1874,
  1877,
  1884,
  1885,
  1886,
  1895,
  1897,
  1900,
  1902,
  1911,
  1912,
  1914,
  1915,
  1916,
  1917,
  1919,
  1924,
  1925,
  1926,
  1927,
  1929,
  1930,
  1933,
  1935,
  1938,
  1940,
  1941,
  1942,
  1944,
  1946,
  1950,
  1951,
  ...},
 {8193,
  2,
  8195,
  8196,
  3,
  6,
  8198,
  8,
  9,
  8201,
  7,
  8205,
  14,
  8209,
  8210,
  17,
  8212,
  21,
  8214,
  23,
  8216,
  25,
  8217,
  27,
  24,
  29,
  8218,
  31,
  30,
  8226,
  35,
  36,
  8228,
  8231,
  39,
  40,
  8233,
  42,
  8237,
  8238,
  8239,
  8240,
  49,
  8242,
  51,
  8244,
  54,
  8247,
  56,
  8249,
  8250,
  59,
  60,
  8254,
  8255,
  65,
  8259,
  8260,
  69,
  8262,
  8263,
  68,
  73,
  8264,
  75,
  8261,
  77,
  78,
  81,
  82,
  8274,
  8276,
  85,
  8278,
  8279,
  88,
  89,
  90,
  91,
  8284,
  8285,
  8286,
  95,
  8287,
  93,
  92,
  8291,
  101,
  8294,
  103,
  8295,
  106,
  107,
  8299,
  110,
  8302,
  112,
  111,
  8306,
  115,
  8307,
  8310,
  8312,
  8314,
  123,
  122,
  8315,
  127,
  8320,
  129,
  8322,
  131,
  132,
  8325,
  8324,
  8321,
  8328,
  138,
  141,
  8335,
  144,
  145,
  8337,
  8339,
  8338,
  8340,
  150,
  147,
  8345,
  8347,
  8348,
  8349,
  158,
  159,
  8353,
  8355,
  163,
  8357,
  166,
  167,
  8360,
  168,
  8359,
  8362,
  172,
  8358,
  171,
  175,
  174,
  177,
  8369,
  8371,
  8372,
  179,
  180,
  8375,
  8376,
  184,
  8378,
  187,
  188,
  189,
  181,
  8383,
  8385,
  194,
  193,
  196,
  8389,
  8394,
  204,
  205,
  8398,
  8399,
  208,
  207,
  8397,
  8403,
  8402,
  213,
  214,
  8405,
  219,
  220,
  8413,
  222,
  8411,
  8416,
  224,
  227,
  8420,
  231,
  233,
  234,
  235,
  8428,
  8431,
  242,
  8434,
  8435,
  8437,
  246,
  247,
  8440,
  248,
  250,
  251,
  8443,
  253,
  8446,
  8442,
  8444,
  8450,
  8451,
  262,
  8456,
  8458,
  268,
  8460,
  271,
  272,
  273,
  8467,
  276,
  277,
  8469,
  8471,
  8472,
  281,
  8474,
  283,
  8475,
  284,
  286,
  287,
  288,
  8481,
  8482,
  290,
  292,
  8485,
  8486,
  293,
  8490,
  8492,
  8494,
  8497,
  306,
  307,
  308,
  8499,
  8502,
  309,
  313,
  315,
  316,
  8509,
  318,
  8510,
  320,
  8516,
  8517,
  328,
  329,
  8522,
  331,
  8521,
  333,
  8526,
  335,
  8525,
  337,
  332,
  339,
  8527,
  341,
  8529,
  343,
  344,
  8537,
  346,
  345,
  347,
  349,
  8542,
  8544,
  8547,
  8548,
  356,
  8550,
  359,
  358,
  8553,
  8551,
  8552,
  364,
  8549,
  367,
  8562,
  8563,
  8564,
  372,
  374,
  8565,
  371,
  377,
  8570,
  379,
  8569,
  8571,
  375,
  383,
  8576,
  376,
  8573,
  388,
  8580,
  390,
  8584,
  8585,
  8586,
  392,
  393,
  394,
  8587,
  8591,
  8592,
  398,
  402,
  397,
  404,
  8597,
  8598,
  409,
  410,
  8603,
  8601,
  8604,
  414,
  416,
  8610,
  8611,
  8612,
  419,
  8614,
  423,
  8616,
  425,
  426,
  8613,
  428,
  8621,
  424,
  8623,
  431,
  437,
  438,
  441,
  443,
  445,
  451,
  452,
  453,
  457,
  458,
  459,
  460,
  466,
  467,
  469,
  470,
  475,
  481,
  483,
  484,
  486,
  491,
  493,
  494,
  498,
  500,
  501,
  502,
  505,
  506,
  507,
  510,
  513,
  514,
  515,
  521,
  522,
  523,
  524,
  529,
  530,
  536,
  538,
  539,
  542,
  543,
  545,
  547,
  552,
  556,
  559,
  560,
  562,
  563,
  564,
  565,
  566,
  567,
  568,
  570,
  572,
  573,
  581,
  589,
  590,
  591,
  593,
  594,
  595,
  596,
  598,
  599,
  600,
  601,
  612,
  614,
  617,
  621,
  623,
  631,
  632,
  633,
  635,
  638,
  642,
  643,
  645,
  647,
  649,
  653,
  657,
  658,
  659,
  661,
  662,
  665,
  668,
  672,
  674,
  675,
  677,
  680,
  684,
  687,
  695,
  698,
  699,
  701,
  703,
  704,
  705,
  706,
  707,
  708,
  709,
  712,
  713,
  715,
  716,
  721,
  723,
  726,
  727,
  728,
  733,
  735,
  738,
  740,
  742,
  743,
  746,
  747,
  748,
  749,
  753,
  755,
  757,
  758,
  762,
  765,
  766,
  767,
  768,
  769,
  771,
  772,
  773,
  774,
  775,
  783,
  787,
  793,
  794,
  796,
  797,
  799,
  800,
  804,
  805,
  809,
  810,
  812,
  817,
  819,
  823,
  825,
  830,
  832,
  833,
  840,
  841,
  844,
  845,
  846,
  848,
  850,
  853,
  858,
  859,
  861,
  862,
  863,
  867,
  868,
  871,
  872,
  173,
  874,
  876,
  877,
  878,
  879,
  883,
  884,
  889,
  890,
  892,
  893,
  895,
  897,
  899,
  900,
  902,
  904,
  908,
  909,
  911,
  913,
  914,
  917,
  920,
  923,
  926,
  927,
  928,
  931,
  935,
  937,
  938,
  939,
  941,
  942,
  943,
  944,
  948,
  951,
  952,
  954,
  956,
  957,
  958,
  962,
  963,
  967,
  969,
  971,
  972,
  973,
  974,
  976,
  977,
  978,
  980,
  982,
  984,
  985,
  993,
  996,
  998,
  1000,
  1002,
  1003,
  1005,
  1006,
  1008,
  1010,
  1011,
  1013,
  1017,
  1021,
  1027,
  1028,
  1031,
  1032,
  1035,
  1037,
  1039,
  1040,
  1042,
  1043,
  1045,
  1049,
  1052,
  1054,
  1056,
  1057,
  1058,
  1059,
  1060,
  1061,
  1063,
  1065,
  1067,
  1069,
  1070,
  1072,
  1074,
  1075,
  1078,
  1079,
  1081,
  1083,
  1092,
  1095,
  1097,
  1098,
  1104,
  1105,
  1106,
  1107,
  1108,
  1109,
  1111,
  1114,
  1122,
  1123,
  8364,
  1125,
  1126,
  1124,
  1129,
  1132,
  1135,
  1137,
  1144,
  1146,
  1147,
  1148,
  1149,
  1150,
  1151,
  1153,
  1154,
  1155,
  1157,
  1158,
  1162,
  1163,
  1164,
  1166,
  1172,
  1176,
  1177,
  1179,
  1183,
  1184,
  1186,
  1187,
  1188,
  1189,
  1202,
  1203,
  1204,
  1205,
  1207,
  1217,
  1219,
  1220,
  1224,
  1227,
  1229,
  1230,
  1231,
  1236,
  1237,
  1238,
  1239,
  1240,
  1242,
  1244,
  1245,
  1247,
  1248,
  1252,
  1253,
  1257,
  1258,
  1263,
  1264,
  1270,
  1271,
  1275,
  1276,
  1277,
  1283,
  1284,
  1285,
  1287,
  1289,
  1290,
  1293,
  1297,
  1298,
  1299,
  1300,
  1303,
  1305,
  1308,
  1309,
  1314,
  1317,
  1322,
  1323,
  1330,
  1332,
  1336,
  1339,
  1341,
  1347,
  1352,
  1354,
  1356,
  1359,
  1363,
  1364,
  1366,
  1368,
  1369,
  1370,
  1371,
  1373,
  1383,
  1384,
  1387,
  1392,
  1394,
  1395,
  1398,
  1406,
  1409,
  280,
  1416,
  1419,
  1422,
  1423,
  1424,
  1426,
  1427,
  1428,
  1429,
  1433,
  1438,
  1440,
  1443,
  1444,
  1449,
  1450,
  1451,
  1452,
  1454,
  1455,
  1457,
  1459,
  1460,
  1461,
  1468,
  1470,
  1471,
  1472,
  1473,
  1474,
  1475,
  1479,
  1480,
  1481,
  1482,
  1483,
  1487,
  1491,
  1493,
  1494,
  1496,
  1500,
  1501,
  1502,
  1506,
  1507,
  1509,
  1510,
  1511,
  1512,
  1513,
  1514,
  1516,
  1518,
  1523,
  1525,
  1527,
  1529,
  1531,
  1532,
  1535,
  1537,
  1538,
  1542,
  1543,
  1545,
  1546,
  1548,
  1549,
  1552,
  1553,
  1554,
  1556,
  1562,
  1565,
  1566,
  1567,
  1568,
  1569,
  1575,
  1578,
  1579,
  1583,
  1585,
  1586,
  1589,
  1590,
  1591,
  1592,
  1594,
  1597,
  1601,
  1605,
  1606,
  1607,
  1608,
  1610,
  1613,
  1614,
  1615,
  1617,
  1619,
  1620,
  1621,
  1622,
  1625,
  1631,
  1643,
  1644,
  1646,
  1647,
  1648,
  1651,
  1654,
  1657,
  1659,
  1663,
  1664,
  1665,
  1670,
  1671,
  1673,
  1676,
  1677,
  1682,
  1683,
  1689,
  1690,
  1691,
  1692,
  1693,
  1694,
  1696,
  1704,
  1705,
  1711,
  1713,
  1716,
  1718,
  1721,
  1723,
  1728,
  1730,
  1732,
  1734,
  1741,
  1743,
  1747,
  1748,
  1749,
  1752,
  1753,
  1755,
  1760,
  1762,
  1763,
  1765,
  1766,
  1767,
  1768,
  1770,
  1771,
  1778,
  1779,
  1780,
  1794,
  1796,
  1797,
  1800,
  1802,
  1803,
  1805,
  1806,
  1807,
  1808,
  1809,
  1811,
  1812,
  1814,
  1815,
  1816,
  1817,
  1818,
  1820,
  1821,
  1822,
  1825,
  1835,
  1838,
  1839,
  1842,
  1844,
  1848,
  1852,
  1853,
  1857,
  1859,
  1861,
  1862,
  1864,
  1865,
  1867,
  1879,
  1880,
  1881,
  1883,
  1887,
  1888,
  1889,
  1890,
  1892,
  1896,
  1898,
  1899,
  1903,
  1904,
  1905,
  1906,
  1910,
  1913,
  1918,
  1920,
  1921,
  1922,
  ...})
In [ ]:
nxcomm.quality.modularity(G_und, communities = kl_res)
Out[ ]:
0.0009712584336863395
In [ ]:
kl_res = nxcomm.kernighan_lin_bisection(G_und_lcc, weight = 'Score')
In [ ]:
nxcomm.quality.modularity(G_und_lcc, communities = kl_res)
Out[ ]:
0.0054802360428808095

MATCHES BETWEEN EXPREINCED PLAYERS(MORE THAN 100 GAMES)

In [ ]:
more_than_hundred_game = player_stats[player_stats.total_game_count > 100]['Player'].unique()
sub_ = train[train['White Player #'].isin(more_than_hundred_game)]
sub_ = sub_[sub_['Black Player #'].isin(more_than_hundred_game)]
sub_.head()
Out[ ]:
Unnamed: 0 Month # White Player # Black Player # Score
9 9 1 158 8059 1.0
26 26 1 748 4073 0.5
93 93 1 1860 2605 0.0
111 111 1 2283 8388 0.5
127 127 1 2605 7802 1.0
In [ ]:
more_than_hundred_game = player_stats[player_stats.total_game_count > 100]
In [ ]:
more_than_hundred_game.describe()
Out[ ]:
Score Player black_draw black_lost black_win white_draw white_lost white_win total_score total_game_count Avg_Score
count 174.000000 174.000000 174.000000 174.000000 174.000000 174.000000 174.000000 174.000000 174.000000 174.000000
mean 4552.074713 37.247126 15.166667 18.666667 33.839080 9.402299 28.637931 82.847701 142.959770 0.577484
std 2571.114452 14.164674 6.223286 6.821704 12.336209 4.584366 10.225829 25.053897 39.981551 0.044836
min 64.000000 13.000000 2.000000 8.000000 14.000000 1.000000 9.000000 48.000000 101.000000 0.421053
25% 2286.000000 27.000000 11.000000 14.000000 25.000000 6.000000 22.000000 64.500000 113.000000 0.551837
50% 4856.000000 35.000000 15.000000 18.000000 31.000000 9.000000 26.500000 78.000000 131.500000 0.579175
75% 6941.000000 43.750000 19.000000 21.000000 40.750000 12.000000 33.000000 91.875000 158.750000 0.605709
max 8616.000000 91.000000 33.000000 47.000000 73.000000 26.000000 67.000000 167.500000 280.000000 0.701923
In [ ]:
sub_.describe()
Out[ ]:
Unnamed: 0 Month # White Player # Black Player # Score
count 5483.000000 5483.000000 5483.000000 5483.000000 5483.000000
mean 25888.560642 56.558271 4489.606602 4462.578515 0.556265
std 14111.184999 28.151924 2656.048413 2657.256351 0.324679
min 9.000000 1.000000 64.000000 64.000000 0.000000
25% 15474.500000 37.000000 1880.000000 1860.000000 0.500000
50% 26444.000000 59.000000 4577.000000 4577.000000 0.500000
75% 35402.500000 80.000000 7053.000000 7002.000000 1.000000
max 58620.000000 100.000000 8616.000000 8616.000000 1.000000
In [ ]:
 match_count_between_experienced=pd.DataFrame(sub_.groupby(['White Player #','Black Player #'])['Score'].count()).reset_index()
In [ ]:
G = nx.from_pandas_edgelist(match_count_between_experienced, source='White Player #', target='Black Player #', edge_attr=True, create_using = nx.Graph())
In [ ]:
match_count_between_experienced.Score.sum()
Out[ ]:
5483
In [ ]:
G_und = G.to_undirected(reciprocal=False)

for u, v, d in G_und.edges(data=True):
    G_und[u][v]['Score'] = 0

for u, v, d in G.edges(data=True):
    G_und[u][v]['Score'] += G[u][v]['Score']
In [ ]:
print(nx.info(G_und))
Name: 
Type: Graph
Number of nodes: 174
Number of edges: 3352
Average degree:  38.5287
In [ ]:
import collections
import matplotlib.pyplot as plt

degree_sequence = sorted([d for n, d in G_und.degree()], reverse=True)  # degree sequence
degreeCount = collections.Counter(degree_sequence)
deg, cnt = zip(*degreeCount.items())

fig, ax = plt.subplots()
plt.bar(deg, cnt, width=0.80, color="b")

plt.title("Degree Histogram")
plt.ylabel("Count")
plt.xlabel("Degree")
ax.set_xticks([d + 0.4 for d in deg])
ax.set_xticklabels(deg)

plt.show()
In [ ]:
import matplotlib.pyplot as plt
import networkx as nx

degrees = [G_und.degree(n) for n in G_und.nodes()]
plt.hist(degrees, bins=8)
plt.show()
In [ ]:
strengths = [G_und.degree(n, weight='Score') for n in G_und.nodes()]
plt.hist(strengths, bins = 8)
plt.show()
In [ ]:
nx.density(G_und)
Out[ ]:
0.22270945452129426
In [ ]:
cliques = list(nx.find_cliques(G_und))
cliques
Out[ ]:
[[1, 4609, 1377],
 [1, 4609, 7238, 5833],
 [1, 4609, 5170, 6110, 5472],
 [1, 4609, 5170, 6110, 2463],
 [1, 4609, 701],
 [1, 8449],
 [1, 5895],
 [1, 4488, 8035, 2533],
 [1, 5385],
 [1, 6281, 2225, 5394, 235],
 [1, 6281, 4822],
 [1, 8585],
 [1, 7816, 3105],
 [1, 7816, 6587],
 [1, 7816, 3614, 2463],
 [1, 7053],
 [1, 4751, 2225],
 [1, 3347],
 [1, 3105, 76],
 [1, 3105, 2805, 1645],
 [1, 3108, 6982],
 [1, 8103],
 [1, 1707, 701, 1383],
 [1, 1712],
 [1, 4406],
 [1, 8248, 8288],
 [1, 8248, 488],
 [1, 8248, 6110],
 [1, 5951],
 [1, 6982, 8288],
 [1, 3655, 1377],
 [1, 76, 5472],
 [1, 76, 7238],
 [1, 4686, 8035],
 [1, 4822, 5170, 6110, 2463],
 [1, 2007],
 [1, 4696],
 [1, 5846],
 [1, 5342, 2533],
 [1, 3683, 701],
 [1, 2533, 5833],
 [1, 3065],
 [1, 2683, 7238],
 [1, 3837, 5833, 7238],
 [2, 4179],
 [3, 4931, 319],
 [3, 8419, 6677],
 [3, 231],
 [3, 2760],
 [3, 3147],
 [3, 3883],
 [4, 2574, 8016, 428],
 [4, 8465, 5850],
 [4, 8465, 7477],
 [4, 8465, 7094],
 [4, 8465, 5671],
 [4, 6937, 7900],
 [4, 6937, 902],
 [4, 3995],
 [4, 2084, 7900],
 [4, 2084, 7477],
 [4, 2084, 7094],
 [4, 934, 5477],
 [4, 5671, 5753],
 [4, 5671, 2250],
 [4, 5671, 5477],
 [4, 5415, 8133],
 [4, 5415, 2813],
 [4, 4777, 8433],
 [4, 4777, 7900],
 [4, 6185, 2129],
 [4, 6185, 5082],
 [4, 2091, 8433, 5082, 5136],
 [4, 2091, 8433, 5082, 4694],
 [4, 2091, 8433, 5082, 7751],
 [4, 2091, 8433, 2813],
 [4, 2091, 8433, 902, 5136],
 [4, 2091, 8433, 902, 4694],
 [4, 2091, 596, 5136, 5082],
 [4, 2091, 596, 5136, 902],
 [4, 2091, 596, 7751, 5082],
 [4, 813],
 [4, 1452],
 [4, 7477, 7029, 598],
 [4, 2250, 7900],
 [4, 2250, 4694],
 [4, 8016, 1019],
 [4, 598, 7029, 5850],
 [4, 3544, 5477],
 [4, 5850, 5995],
 [4, 3818],
 [4, 5995, 596],
 [4, 1517],
 [4, 6010],
 [4, 3198],
 [5, 870, 7849],
 [5, 870, 3619, 96],
 [5, 870, 3619, 6717],
 [5, 2919, 5272],
 [5, 2919, 8045, 7849],
 [5, 2919, 8045, 2548],
 [5, 8045, 4854, 7849],
 [5, 8045, 4854, 2548],
 [5, 4854, 5272],
 [6, 5440, 3025],
 [6, 5440, 5676, 1302],
 [6, 5347],
 [6, 488, 3861],
 [6, 5004, 5676, 1302],
 [6, 6573],
 [6, 7281],
 [6, 7698],
 [7, 3728, 4121, 1996],
 [7, 4244, 5495],
 [7, 5396],
 [7, 1563],
 [7, 1567, 1996, 5839],
 [7, 7199, 8482],
 [7, 7199, 6061],
 [7, 7199, 5839],
 [7, 8482, 1065],
 [7, 6061, 1856, 1591],
 [7, 6061, 7000],
 [7, 1856, 2742, 6073],
 [7, 1856, 5839, 6073],
 [7, 1856, 5839, 1202],
 [7, 5826, 2472],
 [7, 5826, 1996, 4121, 5839, 6073],
 [7, 5826, 1996, 4121, 5839, 1202],
 [7, 5826, 1996, 4121, 1591],
 [7, 5826, 1996, 8324],
 [7, 5826, 2742, 6073],
 [7, 7362],
 [7, 6339, 2256],
 [7, 2773],
 [7, 7000, 2742],
 [7, 4699, 4121],
 [7, 4699, 5495],
 [7, 2271],
 [7, 5472],
 [7, 5495, 6073],
 [8, 7751],
 [9, 5764],
 [9, 8629],
 [9, 3278],
 [10, 1161, 6819, 4506],
 [10, 1161, 6819, 4971],
 [10, 1161, 2542],
 [12, 3655, 813],
 [12, 3655, 7989],
 [12, 3655, 8311],
 [12, 3739],
 [12, 636],
 [12, 7006],
 [12, 4063, 813],
 [12, 4063, 7989],
 [12, 4063, 8311],
 [13, 6759],
 [14, 4775],
 [16, 3540],
 [16, 941],
 [16, 7750, 2002],
 [16, 2015],
 [17, 595],
 [18, 6049, 7441],
 [18, 6049, 7242],
 [18, 6049, 2957],
 [18, 6049, 8629],
 [18, 7620],
 [18, 5419, 2271, 8629],
 [18, 5419, 4283],
 [18, 5419, 2599, 840, 7069],
 [18, 5419, 2599, 7242],
 [18, 5419, 2599, 2957],
 [18, 5419, 2599, 1615],
 [18, 5419, 2599, 8629],
 [18, 6924],
 [18, 19, 6261],
 [18, 19, 1615],
 [18, 3540, 2908],
 [18, 661],
 [18, 2683, 8629, 2599],
 [18, 1533, 840, 7069],
 [18, 1533, 7242],
 [18, 1533, 2957],
 [18, 4287],
 [19, 8224],
 [19, 4226],
 [19, 3431, 2925],
 [19, 1869],
 [19, 2806, 6552],
 [21, 8000, 3464],
 [21, 6786],
 [21, 77],
 [21, 2321],
 [21, 3635],
 [21, 7604],
 [21, 5811],
 [23, 2936],
 [24, 5798, 4446],
 [24, 8219],
 [24, 4778],
 [24, 6864],
 [24, 7347],
 [24, 6007],
 [24, 2203],
 [25, 5778],
 [25, 5317],
 [26, 2472],
 [26, 8324],
 [26, 3574, 6015],
 [26, 860],
 [27, 2560, 1020],
 [27, 6536, 8011],
 [27, 562, 6776],
 [27, 562, 1020],
 [27, 2685],
 [29, 8324, 6647],
 [29, 4101],
 [29, 7943, 6647],
 [29, 5839, 1272],
 [29, 5839, 4241],
 [29, 5436],
 [30, 3675],
 [30, 59],
 [30, 6555],
 [31, 8320],
 [32, 3505],
 [32, 2182],
 [34, 1673],
 [34, 8111],
 [34, 2579],
 [34, 8115],
 [34, 664],
 [35, 3720],
 [35, 4873, 8048],
 [35, 1994],
 [35, 4150],
 [35, 828],
 [36, 64],
 [36, 2084],
 [36, 1126, 3612],
 [36, 2737, 6985],
 [36, 2737, 614],
 [36, 4562],
 [36, 1522],
 [36, 8342],
 [36, 2105],
 [36, 1178],
 [36, 6010],
 [39, 6680],
 [40, 6632],
 [40, 2849, 6670],
 [40, 5420],
 [40, 6054, 934],
 [40, 6054, 6670],
 [42, 8321],
 [42, 5963],
 [43, 3489, 3870],
 [43, 7074, 3843],
 [43, 7074, 220],
 [43, 7428, 6968],
 [43, 7428, 3509],
 [43, 7619, 1500, 6532],
 [43, 7619, 1500, 2847],
 [43, 7619, 6835, 7061, 4137],
 [43, 7619, 6835, 7061, 595],
 [43, 7619, 6835, 2847],
 [43, 6753, 6968],
 [43, 6753, 1977],
 [43, 6753, 1500],
 [43, 619, 6532],
 [43, 619, 7983],
 [43, 7983, 7709],
 [43, 3505],
 [43, 6493, 7962],
 [43, 6968, 6532],
 [43, 1977, 2847],
 [43, 220, 2847],
 [43, 7709, 1500, 6532],
 [43, 3870, 4137],
 [43, 3870, 2847],
 [44, 6757],
 [45, 7425],
 [45, 5826, 2472],
 [45, 5826, 5916],
 [45, 6647],
 [45, 4699],
 [45, 2717],
 [46, 8617, 2888, 7747],
 [46, 8617, 1126],
 [46, 699, 1126],
 [46, 2838],
 [48, 3210],
 [48, 4518],
 [48, 462],
 [49, 591, 6162, 8291],
 [49, 591, 6162, 8285],
 [49, 591, 2716, 3593, 4379],
 [49, 591, 8326, 3593, 4379],
 [49, 591, 8326, 3593, 8285],
 [49, 591, 8326, 8291],
 [49, 591, 8326, 5879],
 [49, 591, 1855, 3593, 4379],
 [51, 7364, 7298],
 [51, 7364, 1019],
 [51, 6212, 7412],
 [51, 2532],
 [51, 4201],
 [51, 4714, 1019],
 [51, 4714, 3542, 6582],
 [51, 6346, 7298],
 [51, 6346, 1019, 5852],
 [51, 6346, 7412],
 [51, 7312],
 [51, 2070],
 [51, 279],
 [51, 1148],
 [52, 2145],
 [52, 7817],
 [52, 4710],
 [52, 2799, 6228],
 [53, 7395, 5006],
 [54, 7877],
 [54, 6378],
 [54, 3610],
 [54, 2996],
 [54, 1620],
 [54, 3671],
 [54, 6650],
 [54, 2811],
 [54, 4317],
 [55, 3048, 2640, 2038, 638],
 [55, 3048, 4543],
 [55, 5257, 5364],
 [55, 5257, 6628, 1304, 2640, 2038, 638],
 [55, 5257, 6628, 1304, 2640, 2038, 3054],
 [55, 5257, 6628, 1304, 7322, 638],
 [55, 4725, 638, 2038],
 [56, 7416],
 [56, 5763],
 [56, 391, 4850],
 [56, 391, 2867],
 [56, 391, 3614],
 [56, 391, 2271],
 [56, 5255],
 [56, 5289],
 [56, 2762, 5356, 1700],
 [56, 2552, 5504],
 [56, 2552, 2032, 5107],
 [56, 2552, 5419],
 [56, 2552, 1700, 5107],
 [56, 2552, 1700, 5356],
 [56, 6220],
 [56, 4850, 5419],
 [56, 5044],
 [56, 2168],
 [56, 1657],
 [56, 2271, 5419],
 [57, 4740],
 [57, 6125],
 [58, 8385],
 [58, 4564],
 [58, 2308],
 [58, 3511],
 [59, 6369],
 [59, 1955],
 [59, 7560],
 [59, 5010, 7516],
 [59, 7860],
 [59, 4537],
 [59, 7323],
 [60, 6075],
 [60, 5454],
 [61, 2978],
 [61, 6307, 8092],
 [61, 6307, 5487, 376],
 [61, 6307, 5487, 946],
 [61, 7576, 732],
 [61, 2202, 5487, 376],
 [61, 2202, 5487, 946],
 [62, 81],
 [62, 7929, 4407],
 [63, 6993],
 [63, 8274],
 [63, 2771],
 [65, 1048],
 [65, 7587, 7346],
 [65, 7587, 540],
 [66, 7489],
 [66, 2987, 1241],
 [66, 2987, 524],
 [66, 2987, 5302],
 [66, 6065, 524],
 [67, 6982, 1964],
 [67, 2696],
 [67, 7375],
 [67, 3089],
 [67, 1112],
 [67, 1661, 7201, 313],
 [67, 1661, 7201, 263],
 [67, 1661, 5990, 263],
 [68, 3378],
 [68, 5125],
 [68, 5663, 8195],
 [68, 5663, 4157, 7391],
 [68, 5663, 4382, 6366, 1814],
 [68, 5663, 4382, 7391],
 [69, 3016],
 [71, 4812],
 [71, 748, 304],
 [71, 501],
 [71, 6263],
 [71, 793],
 [71, 639],
 [72, 2603, 3567],
 [73, 8599, 5097, 3944, 3983],
 [73, 8599, 5097, 231],
 [73, 7575, 6856, 1706],
 [73, 7575, 5097, 1880],
 [73, 7575, 5097, 6740],
 [73, 7575, 5097, 1006],
 [73, 536, 1109],
 [73, 4761, 3983, 8405],
 [73, 4761, 6740],
 [73, 4761, 231, 7353],
 [73, 2203, 8405, 1455],
 [73, 2203, 1006, 7353],
 [73, 2203, 1006, 1455],
 [73, 2346, 1109],
 [73, 7353, 5097, 2033],
 [73, 7353, 5097, 1006, 231],
 [73, 7353, 3405],
 [73, 6458, 3944, 7411, 5070],
 [73, 6458, 5575],
 [73, 7483, 1880],
 [73, 4807, 6119],
 [73, 6740, 3405],
 [73, 8405, 1455, 1880],
 [73, 2647],
 [73, 5463, 1880],
 [73, 5209, 1455, 1880],
 [73, 5209, 1455, 418],
 [73, 5209, 1455, 4216, 6119],
 [73, 4216, 3944, 1455],
 [73, 3961, 6856],
 [73, 3961, 3983],
 [73, 6268, 6856, 3944, 1706],
 [73, 6268, 6856, 2033],
 [73, 6268, 5097, 231, 1006],
 [73, 6268, 5097, 231, 5575],
 [73, 6268, 5097, 3983, 1006, 3944],
 [73, 6268, 5097, 3983, 1006, 7375],
 [73, 6268, 5097, 1455, 418, 1246],
 [73, 6268, 5097, 1455, 3944, 1880],
 [73, 6268, 5097, 1455, 3944, 1006],
 [73, 6268, 5097, 1455, 7375, 5104, 5575],
 [73, 6268, 5097, 1455, 7375, 1006],
 [73, 6268, 5097, 2033, 1880],
 [73, 6268, 5097, 3987, 1006, 7038],
 [73, 6268, 5097, 3987, 1006, 7375],
 [73, 6268, 3405],
 [73, 6268, 7411, 1455, 3944],
 [73, 6268, 7411, 1455, 7375],
 [73, 6268, 7321, 5104, 5575, 7375],
 [73, 6268, 1759, 7038, 1006],
 [74, 5285],
 [75, 3985, 727],
 [75, 3985, 1420],
 [75, 3985, 4279],
 [75, 6434, 7884, 1840, 4279],
 [75, 6434, 7884, 1840, 727],
 [75, 6434, 7884, 1915, 4279],
 [75, 6434, 7884, 1915, 727],
 [75, 6434, 1420, 1915],
 [77, 4672, 517],
 [77, 4672, 6525],
 [77, 4672, 7791],
 [77, 4962],
 [77, 8036],
 [77, 3654],
 [77, 7178],
 [77, 1482],
 [77, 7379],
 [77, 2643],
 [77, 471],
 [77, 2232, 6525],
 [78, 7802],
 [78, 639],
 [79, 6628, 4261],
 [79, 7004],
 [80, 1696],
 [80, 3496],
 [80, 7308],
 [80, 941, 7002],
 [80, 6451, 2015],
 [82, 2903, 4576],
 [82, 2903, 1716, 4287],
 [83, 4063, 801, 813],
 [83, 4063, 1977],
 [83, 4063, 1903],
 [83, 2991],
 [84, 4105, 8083, 7520, 1388],
 [84, 4105, 8083, 7520, 4766],
 [84, 4105, 8083, 5025],
 [84, 4105, 8083, 6283],
 [84, 683, 6283],
 [84, 683, 1388],
 [84, 683, 4766],
 [85, 3328, 7141],
 [85, 5128, 7325],
 [85, 5866],
 [85, 8016],
 [85, 885, 3010],
 [85, 885, 3283, 7325],
 [85, 885, 7548],
 [85, 8375, 3283],
 [85, 8375, 7548],
 [85, 3834, 7325],
 [86, 6866, 2645, 2603, 6989],
 [86, 6866, 2645, 2603, 4175, 591],
 [86, 6866, 2645, 2667, 4175, 591],
 [88, 7491],
 [88, 1860, 2409],
 [88, 4858],
 [88, 1033],
 [88, 3834],
 [88, 2684],
 [89, 490],
 [90, 1769],
 [91, 6942],
 [92, 8174],
 [93, 1491],
 [95, 5776],
 [95, 7225],
 [95, 2398],
 [95, 6783],
 [96, 1281, 8355, 6196],
 [96, 1281, 2605],
 [96, 1538, 870, 8121, 856],
 [96, 1538, 870, 8121, 8415],
 [96, 1538, 870, 3619, 856, 7565],
 [96, 1538, 870, 3619, 1340],
 [96, 1538, 1779, 3619, 1340],
 [96, 1538, 1779, 5876],
 [96, 1538, 1779, 6196, 8415],
 [96, 1538, 6808, 856],
 [96, 1538, 6589, 8415],
 [96, 515, 6993],
 [96, 515, 2605],
 [96, 515, 4073],
 [96, 1539, 409],
 [96, 5378, 856],
 [96, 6029, 3657],
 [96, 6029, 4898],
 [96, 6029, 1779],
 [96, 4375, 7139],
 [96, 6302],
 [96, 4898, 4073],
 [96, 4898, 4004],
 [96, 8355, 3619, 856],
 [96, 8355, 3619, 1779],
 [96, 8355, 6196, 1779],
 [96, 4004, 8415],
 [96, 2605, 6808],
 [96, 2605, 1779],
 [96, 2605, 1397],
 [96, 4805],
 [96, 1746, 7139],
 [96, 1746, 1397],
 [96, 6880],
 [96, 7139, 8121],
 [96, 2152],
 [96, 4073, 1779, 5876],
 [96, 4073, 1779, 1340],
 [96, 4073, 1779, 8415],
 [96, 4073, 1397],
 [96, 4846],
 [96, 1397, 856],
 [97, 4732],
 [98, 4609, 5472, 5170, 6110],
 [98, 4609, 5472, 8287, 4427],
 [98, 4609, 5472, 8287, 8059],
 [98, 4609, 8059, 1187, 8287],
 [98, 4609, 8059, 7238, 5833],
 [98, 4609, 8059, 7238, 5435],
 [98, 4609, 8059, 1098, 3344],
 [98, 4609, 8059, 1098, 8343],
 [98, 4609, 8059, 3344, 8287],
 [98, 4609, 8059, 8343, 6586],
 [98, 4609, 5833, 2867, 3242],
 [98, 4609, 5833, 7238, 3242, 2479],
 [98, 4609, 5833, 7238, 5886],
 [98, 4609, 4427, 3344, 1098],
 [98, 4609, 4427, 3344, 8287],
 [98, 4609, 4427, 5435],
 [98, 4609, 2235, 5435, 5170, 2867],
 [98, 4609, 5886, 5435, 7238],
 [98, 4609, 7439, 6110],
 [98, 4609, 4850, 1187, 8287],
 [98, 4609, 4850, 3242, 5170],
 [98, 4609, 4850, 3242, 7450],
 [98, 4609, 4850, 3242, 7238, 2479],
 [98, 4609, 4850, 1098, 3344, 2479],
 [98, 4609, 4850, 3344, 8287],
 [98, 4609, 4850, 6586, 7450],
 [98, 4609, 2867, 3242, 5435, 7450],
 [98, 4609, 2867, 3242, 5435, 5170],
 [98, 4609, 5435, 3242, 7238],
 [98, 4609, 6110, 6586],
 [98, 4609, 6110, 2479],
 [98, 4609, 5983],
 [98, 2567, 4776],
 [98, 2567, 4427],
 [98, 2567, 2479],
 [98, 2059, 8084, 6212],
 [98, 8210, 6850, 6110],
 [98, 8210, 6850, 6038],
 [98, 8210, 6235, 6110],
 [98, 543, 2332],
 [98, 543, 5886],
 [98, 1591, 6212],
 [98, 6212, 6850, 4850, 6586],
 [98, 6212, 6850, 4850, 7638],
 [98, 6212, 6850, 8415],
 [98, 6212, 6850, 1594, 7638],
 [98, 6212, 6850, 4399, 6586],
 [98, 6212, 3362, 7638],
 [98, 6212, 3362, 8415],
 [98, 6212, 2663],
 [98, 6212, 1683],
 [98, 6212, 8084, 1594, 7638],
 [98, 6212, 8084, 8415],
 [98, 6212, 6104],
 [98, 6212, 5886, 4399],
 [98, 4171, 3591, 2416, 7238],
 [98, 4171, 3591, 5833, 7238],
 [98, 4171, 3591, 4850, 3344, 1098],
 [98, 4171, 3591, 4850, 3344, 6341],
 [98, 4171, 3591, 4850, 7238],
 [98, 4171, 7306, 4776, 7238],
 [98, 4171, 7306, 3242, 7238, 5435],
 [98, 4171, 7306, 3242, 5191, 1563, 5170, 5435, 2841],
 [98, 4171, 7306, 3242, 5191, 1563, 5170, 5435, 391],
 [98, 4171, 7306, 3242, 5191, 4419, 5435, 7865],
 [98, 4171, 7306, 3242, 5191, 4419, 5435, 5170, 2841],
 [98, 4171, 7306, 3242, 5191, 4419, 5435, 5170, 391],
 [98, 4171, 7306, 3242, 5191, 4419, 7118, 7865],
 [98, 4171, 7306, 3242, 5191, 4419, 7118, 5170, 2841],
 [98, 4171, 7306, 3242, 5191, 4419, 7118, 5170, 391],
 [98, 4171, 7306, 8501, 5170, 2841, 5435, 1563],
 [98, 4171, 7306, 8501, 5170, 2841, 7118],
 [98, 4171, 7306, 8501, 5170, 391, 5435, 1563],
 [98, 4171, 7306, 8501, 5170, 391, 7118],
 [98, 4171, 6926, 1373],
 [98, 4171, 6926, 2663],
 [98, 4171, 2841, 5425, 1563],
 [98, 4171, 2841, 5170, 3242, 7890, 4850],
 [98, 4171, 2841, 5170, 3242, 7890, 2867, 5435],
 [98, 4171, 2841, 5170, 3242, 7890, 5191, 1563, 5435],
 [98, 4171, 2841, 5170, 3242, 7890, 5191, 7118],
 [98, 4171, 2841, 5170, 3242, 1782, 1563, 5435, 5191],
 [98, 4171, 2841, 5170, 3242, 1782, 4850],
 [98, 4171, 2841, 5170, 3242, 1782, 4419, 5435, 2867],
 [98, 4171, 2841, 5170, 3242, 1782, 4419, 5435, 5191],
 [98, 4171, 2841, 5170, 3242, 1782, 4419, 7118, 5191],
 [98, 4171, 2841, 5170, 2235, 5435, 2867],
 [98, 4171, 2841, 5170, 2235, 5435, 1563, 8501],
 [98, 4171, 2841, 5170, 2235, 7118, 8501],
 [98, 4171, 2841, 5170, 8501, 7890, 4850],
 [98, 4171, 2841, 5170, 8501, 7890, 5435, 1563],
 [98, 4171, 2841, 5170, 8501, 7890, 7118],
 [98, 4171, 2841, 1100, 3242, 1563, 5435, 5191],
 [98, 4171, 2841, 1100, 3242, 4419, 5435, 2867],
 [98, 4171, 2841, 1100, 3242, 4419, 5435, 5191],
 [98, 4171, 2841, 1100, 3242, 4419, 7118, 5191],
 [98, 4171, 5534, 1373, 1098, 7638, 2479],
 [98, 4171, 5534, 1373, 5983],
 [98, 4171, 4776, 7238, 5833],
 [98, 4171, 4776, 7238, 8267],
 [98, 4171, 4776, 7238, 5531],
 [98, 4171, 4776, 2663],
 [98, 4171, 2867, 3242, 5833],
 [98, 4171, 2867, 3242, 5435, 1105, 5170],
 [98, 4171, 2867, 3242, 5435, 7890, 391, 5170],
 [98, 4171, 2867, 3242, 5435, 4419, 7865, 1782],
 [98, 4171, 2867, 3242, 5435, 4419, 391, 5170, 1782],
 [98, 4171, 2867, 3242, 5435, 4419, 391, 7450],
 [98, 4171, 8121, 1187, 2416],
 [98, 4171, 8121, 1187, 7953, 1594],
 [98, 4171, 8121, 1187, 4850],
 [98, 4171, 8121, 2479, 4850, 6850, 7238],
 [98, 4171, 8121, 2479, 4850, 7139],
 [98, 4171, 8121, 2479, 4850, 1098, 391],
 [98, 4171, 8121, 2479, 1594, 6850, 7238],
 [98, 4171, 8121, 2479, 1594, 1098, 391],
 [98, 4171, 8121, 2416, 7238],
 [98, 4171, 8121, 7953, 1594, 6850],
 [98, 4171, 8121, 7953, 1594, 1098, 391],
 [98, 4171, 8121, 8415, 6850],
 [98, 4171, 7865, 6104],
 [98, 4171, 7865, 4419, 5191, 3242, 1782, 5435],
 [98, 4171, 7865, 4419, 5191, 3242, 1782, 7118],
 [98, 4171, 5435, 3242, 7450, 1563, 391],
 [98, 4171, 5435, 3242, 7238, 7890],
 [98, 4171, 5435, 3242, 5191, 5170, 1105, 1563],
 [98, 4171, 5435, 3242, 5191, 5170, 1723],
 [98, 4171, 5435, 3242, 5191, 5170, 391, 7890, 1563],
 [98, 4171, 5435, 3242, 5191, 5170, 391, 1782, 1563],
 [98, 4171, 5435, 3242, 5191, 5170, 391, 1782, 4419],
 [98, 4171, 5435, 4427],
 [98, 4171, 5435, 8501, 391, 1563, 7890, 5170],
 [98, 4171, 5435, 8501, 391, 1563, 7450],
 [98, 4171, 5435, 7638, 5531, 7238],
 [98, 4171, 5435, 7638, 5531, 391],
 [98, 4171, 5435, 8415],
 [98, 4171, 6850, 6341, 4850, 3344],
 [98, 4171, 6850, 6341, 4850, 7450],
 [98, 4171, 6850, 2479, 1782, 4850],
 [98, 4171, 6850, 2479, 1782, 1594],
 [98, 4171, 6850, 2479, 7638, 4850, 3344],
 [98, 4171, 6850, 2479, 7638, 4850, 5531, 7238],
 [98, 4171, 6850, 2479, 7638, 1594, 3344],
 [98, 4171, 6850, 2479, 7638, 1594, 5531, 7238],
 [98, 4171, 6850, 2479, 7638, 1594, 1373],
 [98, 4171, 6850, 7953, 7638, 1594, 3344],
 [98, 4171, 6850, 7953, 7638, 1594, 5531],
 [98, 4171, 6850, 7953, 7638, 1594, 1373],
 [98, 4171, 4427, 3344, 1098],
 [98, 4171, 7118, 3242, 7450, 4419, 391],
 [98, 4171, 7118, 3242, 5191, 5170, 1105],
 [98, 4171, 7118, 3242, 5191, 5170, 391, 7890],
 [98, 4171, 7118, 3242, 5191, 5170, 391, 1782, 4419],
 [98, 4171, 7118, 8501, 391, 7890, 5170],
 [98, 4171, 7118, 8501, 391, 7450],
 [98, 4171, 7638, 7953, 1594, 1187, 5531],
 [98, 4171, 7638, 7953, 1594, 391, 1098, 3344],
 [98, 4171, 7638, 7953, 1594, 391, 1098, 5531],
 [98, 4171, 7638, 7953, 1594, 391, 1098, 1373],
 [98, 4171, 7638, 1187, 4850, 5531],
 [98, 4171, 7638, 2479, 5833, 7238],
 [98, 4171, 7638, 2479, 1098, 391, 4850, 3344],
 [98, 4171, 7638, 2479, 1098, 391, 4850, 5531],
 [98, 4171, 7638, 2479, 1098, 391, 1594, 3344],
 [98, 4171, 7638, 2479, 1098, 391, 1594, 5531],
 [98, 4171, 7638, 2479, 1098, 391, 1594, 1373],
 [98, 4171, 7638, 2479, 7139, 4850, 5531],
 [98, 4171, 1373, 2416],
 [98, 4171, 1373, 391, 3242, 2479],
 [98, 4171, 5983, 5425],
 [98, 4171, 5983, 4419],
 [98, 4171, 5983, 5531],
 [98, 4171, 4577, 1187, 5531, 7953, 1594],
 [98, 4171, 4577, 1187, 5531, 4850],
 [98, 4171, 4577, 6341, 4850, 3344],
 [98, 4171, 4577, 6341, 4850, 7450],
 [98, 4171, 4577, 6341, 4850, 8267],
 [98, 4171, 4577, 7238, 7890, 3242, 4850],
 [98, 4171, 4577, 7238, 2479, 5833, 3242],
 [98, 4171, 4577, 7238, 2479, 4850, 3242],
 [98, 4171, 4577, 7238, 2479, 4850, 8267],
 [98, 4171, 4577, 7238, 2479, 4850, 5531],
 [98, 4171, 4577, 7238, 2479, 1594, 5531],
 [98, 4171, 4577, 391, 4419, 3242, 5170, 1782, 5191],
 [98, 4171, 4577, 391, 4419, 3242, 7450],
 [98, 4171, 4577, 391, 4419, 8267],
 [98, 4171, 4577, 391, 5191, 3242, 5170, 1563, 7890],
 [98, 4171, 4577, 391, 5191, 3242, 5170, 1563, 1782],
 [98, 4171, 4577, 391, 7953, 1098, 1594, 3344],
 [98, 4171, 4577, 391, 7953, 1098, 1594, 5531],
 [98, 4171, 4577, 391, 4850, 7890, 5170, 3242],
 [98, 4171, 4577, 391, 4850, 7890, 5170, 8501],
 [98, 4171, 4577, 391, 4850, 7890, 1098],
 [98, 4171, 4577, 391, 4850, 5170, 1782, 3242],
 [98, 4171, 4577, 391, 4850, 7450, 3242],
 [98, 4171, 4577, 391, 4850, 7450, 8501],
 [98, 4171, 4577, 391, 4850, 2479, 3242, 1782],
 [98, 4171, 4577, 391, 4850, 2479, 8501],
 [98, 4171, 4577, 391, 4850, 2479, 1098, 3344],
 [98, 4171, 4577, 391, 4850, 2479, 1098, 8267],
 [98, 4171, 4577, 391, 4850, 2479, 1098, 5531],
 [98, 4171, 4577, 391, 4850, 2479, 1098, 1782],
 [98, 4171, 4577, 391, 1594, 1098, 2479, 3344],
 [98, 4171, 4577, 391, 1594, 1098, 2479, 5531],
 [98, 4171, 4577, 391, 1594, 1098, 2479, 1782],
 [98, 4171, 4577, 391, 1563, 7450, 3242],
 [98, 4171, 4577, 391, 1563, 7450, 8501],
 [98, 4171, 4577, 391, 1563, 8501, 7890, 5170],
 [98, 4171, 4577, 1100, 3242, 5191, 4419],
 [98, 4171, 4577, 1100, 3242, 5191, 1563],
 [98, 4171, 4577, 5425, 1563],
 [98, 4171, 4577, 1105, 3242, 5170, 1563, 5191],
 [98, 4171, 4577, 6228],
 [98, 4171, 4577, 5627, 7953, 1098],
 [98, 4171, 4577, 2235, 5170, 1563, 8501],
 [98, 4171, 7139, 1105, 1563],
 [98, 4171, 7139, 4850, 7450],
 [98, 4171, 7139, 4850, 2479, 8267],
 [98, 4171, 7139, 4850, 2479, 1782],
 [98, 4171, 7139, 1563, 7450],
 [98, 4171, 7139, 1563, 1782],
 [98, 4171, 2663, 1098, 391],
 [98, 4171, 2416, 1187, 5531],
 [98, 4171, 2416, 7238, 7890],
 [98, 4171, 2416, 7238, 5531],
 [98, 76, 5472, 8491],
 [98, 76, 5472, 8287],
 [98, 76, 4577, 7238],
 [98, 76, 4577, 8287],
 [98, 76, 2510, 4861],
 [98, 76, 2867],
 [98, 76, 213, 8491],
 [98, 76, 6270],
 [98, 7250],
 [98, 2132, 8447, 1961, 4068],
 [98, 2132, 8447, 4748, 2161],
 [98, 2132, 8447, 4748, 7450],
 [98, 2132, 8267],
 [98, 2132, 6926, 2015],
 [98, 2132, 7439],
 [98, 2132, 4399],
 [98, 6235, 3712],
 [98, 6235, 4068],
 [98, 6235, 7461],
 [98, 6235, 391, 8121],
 [98, 6235, 391, 8267],
 [98, 6235, 391, 5886],
 [98, 6235, 7439, 6110],
 [98, 6235, 4719, 5886],
 [98, 8287, 5472, 4862],
 [98, 8287, 3362, 8121],
 [98, 8287, 7139, 4850, 8121],
 [98, 8287, 7139, 4850, 1782],
 [98, 8287, 2416, 8121, 1187],
 [98, 8287, 2416, 1657],
 [98, 8287, 4850, 1187, 4577],
 [98, 8287, 4850, 1187, 8121],
 [98, 8287, 4850, 391, 7616, 3344],
 [98, 8287, 4850, 391, 7616, 8121],
 [98, 8287, 4850, 391, 7616, 1782],
 [98, 8287, 4850, 391, 4577, 3344],
 [98, 8287, 4850, 391, 4577, 1782],
 [98, 8287, 6038, 8121],
 [98, 8287, 1594, 1782, 4862, 3902],
 [98, 8287, 1594, 1782, 391, 7616, 3902],
 [98, 8287, 1594, 1782, 391, 4577],
 [98, 8287, 1594, 7953, 1187, 4577, 8059],
 [98, 8287, 1594, 7953, 1187, 8121],
 [98, 8287, 1594, 7953, 8059, 3344, 4577],
 [98, 8287, 1594, 7953, 8059, 3902],
 [98, 8287, 1594, 7953, 391, 7616, 3344],
 [98, 8287, 1594, 7953, 391, 7616, 8121],
 [98, 8287, 1594, 7953, 391, 7616, 3902],
 [98, 8287, 1594, 7953, 391, 4577, 3344],
 [98, 8287, 1594, 4862, 1657],
 [98, 8287, 1594, 1657, 4577],
 [98, 6763, 8447, 2841, 6815],
 [98, 6763, 8447, 2841, 5191],
 [98, 6763, 8447, 7865, 5191],
 [98, 4719, 1098, 2663],
 [98, 4719, 1098, 3902],
 [98, 4719, 1098, 3591],
 [98, 4719, 8415],
 [98, 2161, 4577, 1563],
 [98, 2161, 7139, 4748, 1563],
 [98, 2161, 7139, 4748, 8447, 6815],
 [98, 6263, 4033, 8447],
 [98, 6263, 6018],
 [98, 6263, 6341, 8267],
 [98, 6263, 6341, 2332],
 [98, 6263, 4973],
 [98, 1657, 1098, 2434, 4577, 1594],
 [98, 1657, 1098, 2339, 4577],
 [98, 1657, 1098, 2339, 5534],
 [98, 1657, 1098, 2663],
 [98, 1657, 1098, 2479, 4577, 1594, 5531],
 [98, 1657, 1098, 2479, 4577, 8267],
 [98, 1657, 1098, 2479, 7638, 1594, 5531],
 [98, 1657, 1098, 2479, 7638, 1594, 1373],
 [98, 1657, 1098, 2479, 7638, 5534, 1373],
 [98, 1657, 1098, 4862, 1594, 7638],
 [98, 1657, 4399, 6586],
 [98, 1657, 4399, 2434],
 [98, 1657, 2416, 2339],
 [98, 1657, 2416, 5531],
 [98, 1657, 2416, 1373],
 [98, 1657, 213, 1373, 5534, 2479],
 [98, 1657, 6104, 2434],
 [98, 1657, 6586, 2339],
 [98, 1657, 6586, 8267],
 [98, 1657, 5435, 2434],
 [98, 1657, 5435, 5531, 7638],
 [98, 1149, 7953],
 [98, 1149, 5435, 8415],
 [98, 1149, 2332, 6341],
 [98, 1149, 2332, 8415],
 [98, 6270, 1187, 4850],
 [98, 6270, 1187, 4331],
 [98, 6270, 1187, 2015],
 [98, 6270, 6341, 2434],
 [98, 6270, 6341, 2332],
 [98, 6270, 6341, 4850],
 [98, 6270, 1098, 391, 2434],
 [98, 6270, 1098, 391, 4850, 7616],
 [98, 6270, 1098, 391, 4850, 2479],
 [98, 6270, 1098, 4862],
 [98, 6270, 1098, 8084, 2479],
 [98, 6270, 1098, 2332],
 [98, 6270, 1098, 5534, 2479],
 [98, 6270, 4331, 7616, 391],
 [98, 6270, 6926, 2015],
 [98, 6270, 1683, 391],
 [98, 6270, 2015, 391],
 [98, 3712, 5472],
 [98, 3712, 3591],
 [98, 647, 7661],
 [98, 647, 5983],
 [98, 4748, 1563, 5425],
 [98, 4748, 1563, 7139, 7450],
 [98, 4748, 1563, 1100],
 [98, 4748, 1563, 8501, 5170],
 [98, 4748, 1563, 8501, 7450],
 [98, 4748, 4862],
 [98, 4748, 8447, 5425],
 [98, 4748, 8447, 5170],
 [98, 4748, 8447, 7865],
 [98, 4748, 8447, 6815, 7450, 7139],
 [98, 4748, 8447, 6815, 1100],
 [98, 143, 7890, 1563],
 [98, 1683, 2339, 6110],
 [98, 1683, 2339, 391],
 [98, 1683, 7015],
 [98, 1683, 5425, 1563],
 [98, 1683, 5425, 8447],
 [98, 1683, 5435, 391, 1563, 7890],
 [98, 1683, 5435, 391, 1563, 7450],
 [98, 1683, 5435, 391, 1563, 1782],
 [98, 1683, 5435, 391, 1563, 7306],
 [98, 1683, 5435, 391, 2867, 7890],
 [98, 1683, 5435, 391, 2867, 7450],
 [98, 1683, 5435, 391, 2867, 1782],
 [98, 1683, 5435, 391, 5531],
 [98, 1683, 5435, 8447, 7306, 7865],
 [98, 1683, 5435, 8447, 7306, 6815],
 [98, 1683, 5435, 8447, 2867, 7865, 4068],
 [98, 1683, 5435, 8447, 2867, 7865, 1782],
 [98, 1683, 5435, 8447, 2867, 7450],
 [98, 1683, 5435, 8447, 6815, 7450],
 [98, 1683, 5435, 8447, 6815, 4068],
 [98, 1683, 5435, 8447, 6815, 1782],
 [98, 8343, 6586, 8267],
 [98, 8343, 6586, 3902, 8059],
 [98, 8343, 1098, 8267, 8084],
 [98, 8343, 1098, 1373],
 [98, 8343, 1098, 8059, 8491, 3902],
 [98, 8343, 1098, 8059, 8084],
 [98, 6815, 7139, 8447, 1105],
 [98, 6815, 7139, 8447, 4068],
 [98, 6815, 7139, 8447, 1782],
 [98, 6815, 4973],
 [98, 6815, 7118, 3242, 1105],
 [98, 6815, 7118, 3242, 4419, 2841, 4068],
 [98, 6815, 7118, 3242, 4419, 2841, 7306],
 [98, 6815, 7118, 3242, 4419, 2841, 1100],
 [98, 6815, 7118, 3242, 4419, 2841, 7023],
 [98, 6815, 7118, 3242, 4419, 2841, 1782],
 [98, 6815, 7118, 3242, 4419, 7450],
 [98, 6815, 7118, 2235, 2841],
 [98, 6815, 6228],
 [98, 6815, 5435, 6002, 4419, 4068],
 [98, 6815, 5435, 8415],
 [98, 6815, 5435, 8447, 3242, 1105],
 [98, 6815, 5435, 8447, 3242, 4419, 2841, 4068],
 [98, 6815, 5435, 8447, 3242, 4419, 2841, 7306],
 [98, 6815, 5435, 8447, 3242, 4419, 2841, 1100],
 [98, 6815, 5435, 8447, 3242, 4419, 2841, 7023],
 [98, 6815, 5435, 8447, 3242, 4419, 2841, 1782],
 [98, 6815, 5435, 8447, 3242, 4419, 7450],
 [98, 6815, 5435, 8447, 2235, 2841],
 [98, 1700, 6850, 1373],
 [98, 1700, 6850, 8415],
 [98, 1700, 5983, 1373],
 [98, 2750, 6040],
 [98, 2750, 7890],
 [98, 2750, 2339],
 [98, 213, 7450],
 [98, 213, 2479, 3344],
 [98, 213, 2479, 8491, 5534],
 [98, 4331, 1187, 7953, 1594],
 [98, 4331, 391, 7616, 7953, 1594, 3344],
 [98, 4331, 391, 7616, 7953, 1594, 3902],
 [98, 4331, 391, 4570],
 [98, 4331, 2510, 4861],
 [98, 4331, 7023, 6038],
 [98, 7925, 6586],
 [98, 7925, 7238],
 [98, 4861, 7954],
 [98, 4861, 5534],
 [98, 4862, 4419, 1782],
 [98, 4862, 1098, 1594, 3902, 1782],
 ...]
In [ ]:
for i in range(2,15):
  cliques_gt3 = [x for x in cliques if len(x)>i]
  print(i+1,len(cliques_gt3))
3 38747
4 25502
5 15429
6 8257
7 4172
8 1505
9 450
10 120
11 34
12 8
13 0
14 0
15 0
In [ ]:
cliques_gt10= [x for x in cliques if len(x)>10]
cliques_gt10
Out[ ]:
[[64, 1594, 1286, 391, 4194, 7616, 8287, 3344, 4037, 2295, 1512],
 [64, 1594, 1286, 391, 4194, 7616, 8287, 3344, 4037, 2295, 7953],
 [64, 1594, 1286, 391, 4194, 7616, 8287, 8388, 7107, 7848, 1512],
 [64, 1594, 1286, 391, 4194, 7616, 8287, 8388, 7107, 7848, 7953],
 [64, 1594, 1286, 391, 4194, 7616, 8287, 8388, 7107, 8121, 1512],
 [64, 1594, 1286, 391, 4194, 7616, 8287, 8388, 7107, 8121, 7953],
 [64, 1594, 1286, 391, 4194, 7616, 8287, 8388, 4037, 7953, 3902],
 [64, 1594, 1286, 391, 4194, 7616, 8287, 8388, 3902, 7848, 7953],
 [64, 1594, 1286, 391, 4194, 7616, 8287, 2295, 7848, 7953, 3902],
 [64, 1594, 1286, 391, 4194, 7616, 8287, 2295, 4037, 3902, 7953],
 [64, 1594, 1286, 158, 4194, 7616, 8287, 2295, 7953, 7848, 3902],
 [64, 4850, 1286, 7616, 4194, 391, 4037, 1512, 8287, 3344, 2295]]
In [ ]:
G_und_filtered = G_und.copy()

for u, v, d in G_und.edges(data=True):
         if G_und[u][v]['Score'] < 5:
           G_und_filtered.remove_edge(u, v)
 
In [ ]:
print(nx.info(G_und))
print(nx.info(G_und_filtered))
Name: 
Type: Graph
Number of nodes: 174
Number of edges: 3352
Average degree:  38.5287
Name: 
Type: Graph
Number of nodes: 174
Number of edges: 129
Average degree:   1.4828
In [ ]:
new_cliques = list(nx.find_cliques(G_und_filtered))
new_cliques
Out[ ]:
[[1],
 [2],
 [3],
 [4],
 [5],
 [6],
 [7],
 [8],
 [9],
 [10],
 [11],
 [12],
 [13],
 [14],
 [16],
 [17],
 [18],
 [19],
 [21],
 [23],
 [24],
 [25],
 [26],
 [27],
 [29],
 [30],
 [31],
 [32],
 [34],
 [35],
 [36],
 [39],
 [40],
 [42],
 [43],
 [44],
 [45],
 [46],
 [48],
 [49],
 [51],
 [52],
 [53],
 [54],
 [55],
 [56],
 [57],
 [58],
 [59],
 [60],
 [61],
 [62],
 [63],
 [65],
 [66],
 [67],
 [68],
 [69],
 [71],
 [72],
 [73],
 [74],
 [75],
 [76],
 [77],
 [78],
 [79],
 [80],
 [81],
 [82],
 [83],
 [84],
 [85],
 [86],
 [88],
 [89],
 [90],
 [91],
 [92],
 [93],
 [95],
 [96],
 [97],
 [98, 3242, 7306],
 [98, 4171, 7306],
 [98, 4171, 1782],
 [98, 4171, 391],
 [99],
 [101],
 [102],
 [103],
 [104],
 [105],
 [106],
 [107],
 [108],
 [109],
 [110],
 [111],
 [112],
 [113],
 [114],
 [115],
 [118],
 [119],
 [120],
 [121],
 [122],
 [123],
 [125],
 [127],
 [128, 4375],
 [129],
 [131],
 [132],
 [133],
 [134],
 [135],
 [136],
 [138],
 [140],
 [141],
 [142],
 [143],
 [144],
 [145, 4850, 7228],
 [147, 7747],
 [148],
 [149],
 [150],
 [152],
 [153],
 [154],
 [155],
 [156],
 [157],
 [159],
 [160],
 [161],
 [163],
 [165],
 [166],
 [167],
 [168],
 [169],
 [171],
 [172],
 [173],
 [174],
 [175],
 [176],
 [177],
 [178],
 [179],
 [180, 3386],
 [181],
 [183],
 [184],
 [187, 392],
 [188],
 [189],
 [191],
 [192],
 [193, 6018],
 [194],
 [195],
 [196],
 [197],
 [198],
 [199],
 [200],
 [201],
 [202],
 [203],
 [204],
 [205],
 [206],
 [207],
 [208],
 [209],
 [212],
 [213],
 [214],
 [215],
 [216],
 [217],
 [218],
 [219],
 [220],
 [221],
 [222],
 [223],
 [224],
 [225],
 [226, 5380],
 [227],
 [228],
 [230],
 [231],
 [232],
 [233],
 [234],
 [235],
 [236],
 [237],
 [238],
 [239],
 [240],
 [241],
 [242],
 [243, 2035],
 [244],
 [246],
 [247],
 [248],
 [249],
 [250],
 [251],
 [252],
 [253],
 [254],
 [256],
 [258],
 [260],
 [261],
 [262],
 [263],
 [265],
 [268],
 [269],
 [271],
 [272],
 [273],
 [274],
 [275],
 [276],
 [277],
 [279],
 [280],
 [281],
 [282],
 [283],
 [284],
 [285],
 [286],
 [287],
 [288],
 [289],
 [290],
 [292],
 [293],
 [295],
 [296],
 [297],
 [299],
 [300],
 [301],
 [302],
 [304],
 [306],
 [307],
 [308],
 [309],
 [310],
 [311],
 [312],
 [313],
 [314],
 [315],
 [316],
 [317],
 [318],
 [319],
 [320],
 [321],
 [322],
 [323],
 [324],
 [326],
 [327],
 [328],
 [329],
 [330],
 [331],
 [332],
 [333],
 [334],
 [335],
 [336],
 [337],
 [339],
 [341],
 [342],
 [343],
 [344],
 [345],
 [346],
 [347],
 [349, 3523],
 [351],
 [352],
 [355],
 [356],
 [357],
 [358],
 [359],
 [360],
 [361],
 [363],
 [364],
 [365],
 [367],
 [370],
 [371],
 [372],
 [373],
 [374],
 [375],
 [376],
 [377],
 [379],
 [380],
 [382],
 [383],
 [384],
 [385],
 [386, 4931],
 [386, 391],
 [388],
 [389],
 [390],
 [393],
 [394],
 [395],
 [397],
 [398],
 [399],
 [400],
 [402],
 [403],
 [404],
 [405],
 [406],
 [408, 5983],
 [409],
 [410],
 [411],
 [413],
 [414],
 [416],
 [418],
 [419],
 [420],
 [421],
 [422],
 [423],
 [424],
 [425],
 [426],
 [428],
 [429],
 [430],
 [431],
 [432],
 [433],
 [436],
 [437],
 [438],
 [440],
 [441],
 [443],
 [444],
 [445],
 [447],
 [448],
 [450, 8337],
 [450, 2132],
 [451],
 [452],
 [453],
 [454],
 [456],
 [457],
 [458],
 [459],
 [460],
 [462],
 [463],
 [464],
 [465],
 [466, 6339],
 [467],
 [468],
 [469],
 [470],
 [471],
 [473],
 [474],
 [475],
 [476],
 [477],
 [478],
 [479],
 [480],
 [481],
 [483],
 [484],
 [485],
 [486],
 [488],
 [489],
 [490],
 [491],
 [492],
 [493],
 [494],
 [495],
 [496],
 [497],
 [498],
 [500],
 [501],
 [502],
 [503],
 [504],
 [505],
 [506],
 [507],
 [508],
 [510],
 [512],
 [513],
 [514],
 [515],
 [517],
 [518],
 [519],
 [520],
 [521],
 [522],
 [523],
 [524],
 [525],
 [526],
 [527],
 [529],
 [530],
 [531],
 [532],
 [534],
 [536],
 [537],
 [538],
 [539],
 [540],
 [542],
 [543],
 [544],
 [545],
 [546],
 [547],
 [548],
 [549],
 [550],
 [551],
 [552],
 [553],
 [554],
 [555],
 [556],
 [557],
 [558],
 [559],
 [560],
 [561],
 [562],
 [563],
 [564],
 [565],
 [566],
 [567],
 [568],
 [569],
 [570],
 [571],
 [572],
 [573],
 [575],
 [577],
 [578],
 [579],
 [580],
 [581],
 [582],
 [583],
 [584],
 [585],
 [586],
 [587],
 [588, 2231],
 [589],
 [590],
 [591],
 [592],
 [593],
 [594],
 [595],
 [596, 4162],
 [598],
 [599],
 [600],
 [601],
 [603],
 [605],
 [607],
 [608],
 [609],
 [610],
 [611],
 [612],
 [614],
 [615],
 [616],
 [617],
 [618],
 [619],
 [620],
 [621],
 [623],
 [624],
 [625],
 [626],
 [627],
 [628],
 [629],
 [631],
 [632],
 [633],
 [634],
 [635],
 [636],
 [638, 5417],
 [639],
 [641],
 [642],
 [643],
 [644],
 [645],
 [646],
 [647],
 [648],
 [649],
 [650],
 [651],
 [652],
 [653],
 [654],
 [657],
 [658],
 [659],
 [660],
 [661],
 [662],
 [663],
 [664],
 [665],
 [667],
 [668],
 [670],
 [671],
 [672],
 [673],
 [674],
 [675, 2599],
 [676],
 [677],
 [679],
 [680],
 [681],
 [682],
 [683],
 [684],
 [685],
 [686],
 [687],
 [689],
 [690, 3909],
 [691],
 [693],
 [695],
 [697],
 [698],
 [699, 2362],
 [699, 3523],
 [699, 2581],
 [700],
 [701],
 [703],
 [704],
 [705],
 [706],
 [707],
 [708],
 [709],
 [710],
 [711],
 [712],
 [713],
 [714],
 [715],
 [716],
 [718],
 [719],
 [720],
 [721],
 [722],
 [723],
 [724],
 [725],
 [726],
 [727],
 [728],
 [729],
 [730],
 [731],
 [732],
 [733],
 [735],
 [736],
 [737],
 [738],
 [739],
 [740],
 [741],
 [742],
 [743],
 [744],
 [746],
 [747],
 [748],
 [749],
 [750],
 [751],
 [753],
 [754],
 [755],
 [757],
 [758],
 [759],
 [760],
 [761],
 [762],
 [763],
 [765],
 [766],
 [767],
 [768],
 [769],
 [770],
 [771],
 [772],
 [773],
 [774],
 [775],
 [776],
 [778],
 [779],
 [780],
 [781],
 [782],
 [783],
 [785],
 [786],
 [787],
 [788],
 [790],
 [791],
 [793],
 [794],
 [795],
 [796],
 [797],
 [798],
 [799],
 [800],
 [801],
 [803],
 [804],
 [805],
 [806],
 [807],
 [808],
 [809],
 [810],
 [811],
 [812],
 [813],
 [814],
 [817],
 [818],
 [819],
 [820],
 [823],
 [825],
 [826],
 [827],
 [828],
 [829],
 [830],
 [831],
 [832],
 [833],
 [834],
 [835],
 [837],
 [838],
 [839],
 [840],
 [841],
 [842],
 [843],
 [844],
 [845],
 [846],
 [848],
 [849],
 [850],
 [851],
 [853],
 [856],
 [858],
 [859],
 [860],
 [861],
 [862],
 [863],
 [864],
 [865],
 [867],
 [868],
 [869],
 [870],
 [871],
 [872],
 [873],
 [874],
 [875],
 [876],
 [877],
 [878],
 [879],
 [881],
 [883],
 [884],
 [885],
 [886],
 [887],
 [888],
 [889],
 [890],
 [892],
 [893],
 [894],
 [895, 4162, 898],
 [897],
 [899],
 [900],
 [901],
 [902],
 [903],
 [904],
 [906],
 [908],
 [909],
 [910],
 [911],
 [913],
 [914],
 [916],
 [917],
 [918],
 [920],
 [921],
 [922],
 [923],
 [924],
 [925],
 [926],
 [927],
 [928],
 [929],
 [930],
 [931],
 [933],
 [934],
 [935],
 [936],
 [937],
 [938],
 [939],
 [940],
 [941],
 [942],
 [943, 4484],
 [944],
 [945],
 [946],
 [947],
 [948],
 [949],
 [951],
 [952],
 [954],
 [955],
 [956],
 [957],
 [958],
 [960],
 [962],
 [963],
 [964],
 [965],
 [966],
 [967],
 [968],
 [969],
 [971, 8152, 6850],
 [971, 7447],
 [972],
 [973],
 [974],
 [975],
 [976],
 [977],
 [978],
 [979],
 [980],
 [981],
 [982],
 [983],
 [984],
 [985],
 [986],
 [990],
 [991],
 [992],
 [993],
 [994],
 [996],
 [998],
 [999],
 [1000],
 [1001],
 [1002],
 [1003],
 [1004],
 [1005],
 [1006],
 [1008],
 [1010],
 [1011],
 [1012],
 [1013],
 [1016],
 [1017],
 [1018],
 [1019],
 [1020],
 [1021],
 [1023],
 [1024],
 [1025],
 [1027],
 [1028],
 [1029],
 [1030],
 [1031],
 [1032],
 [1033],
 [1034],
 [1035],
 [1036],
 [1037],
 [1038],
 [1039],
 [1040],
 [1041],
 [1042],
 [1043],
 [1044],
 [1045],
 [1046],
 [1047],
 [1048],
 [1049],
 [1050],
 [1051],
 [1052],
 [1053],
 [1054],
 [1055],
 [1056],
 [1057],
 [1058],
 [1059],
 [1060],
 [1061],
 [1062],
 [1063],
 [1064],
 [1065],
 [1066],
 [1067],
 [1068],
 [1069],
 [1070],
 [1072],
 [1074],
 [1075],
 [1076],
 [1077],
 [1078],
 [1079],
 [1080],
 [1081],
 [1082],
 [1083],
 [1084],
 [1086],
 [1087],
 [1089],
 [1090],
 [1091],
 [1092],
 [1093],
 [1094],
 [1095],
 [1096],
 [1097],
 [1098, 8343],
 [1098, 8388],
 [1098, 4679],
 [1099],
 [1100, 7518],
 [1100, 6815],
 [1101],
 [1102],
 [1104],
 [1105],
 [1106],
 [1107],
 [1108],
 [1109],
 [1110],
 [1111],
 [1112],
 [1114],
 [1115],
 [1116],
 [1117],
 [1118],
 [1119],
 [1120],
 [1121],
 [1122],
 [1123],
 [1124],
 [1125],
 [1126, 2362, 7719],
 [1126, 4628],
 [1127],
 [1128],
 [1129],
 [1130],
 [1132],
 [1133],
 [1134],
 [1135],
 [1136],
 [1137],
 [1139],
 [1140],
 [1141],
 [1142],
 [1143],
 [1144],
 [1145],
 [1146],
 [1147],
 [1148],
 [1149],
 [1150],
 [1151],
 [1152],
 [1153],
 [1154],
 [1155],
 [1156],
 [1157],
 [1158],
 ...]
In [ ]:
for i in range(2,15):
  cliques_gt3 = [x for x in new_cliques if len(x)>i]
  print(i+1,len(cliques_gt3))
3 41
4 15
5 3
6 0
7 0
8 0
9 0
10 0
11 0
12 0
13 0
14 0
15 0
In [ ]:
new_cliques_gt3 = [x for x in new_cliques if len(x)>3]
new_cliques_gt3
Out[ ]:
[[8287, 64, 7848, 158],
 [8287, 64, 7848, 1286],
 [8287, 64, 1594, 158],
 [8287, 64, 1594, 1286],
 [4194, 64, 7953, 7848],
 [4194, 64, 158, 7848],
 [4194, 64, 158, 3344],
 [4194, 64, 158, 1594],
 [4194, 7616, 158, 7848],
 [4194, 7616, 158, 3344],
 [4194, 7616, 158, 1594],
 [2295, 64, 7953, 7848],
 [2295, 64, 158, 7848],
 [2295, 64, 158, 3344],
 [2295, 64, 158, 1594]]
In [ ]:
nx.is_weakly_connected(G)
Out[ ]:
True
In [ ]:
nx.diameter(G_und)
Out[ ]:
4
In [ ]:
print("avarage clustering: ", nx.average_clustering(G_und))
print(nx.transitivity(G_und))
print(nx.average_shortest_path_length(G_und))
avarage clustering:  0.3428757889451725
0.3442435201928873
1.8160255132549332
In [ ]:
from networkx.algorithms import community as nxcomm
kl_res = nxcomm.kernighan_lin_bisection(G_und, weight = 'Score')
nxcomm.quality.modularity(G_und, communities = kl_res)
Out[ ]:
0.03247513506701377
In [ ]:
pos = nx.spring_layout(G_und) #calculate position for each node
# pos is needed because we are going to draw a few nodes at a time,
# pos fixes their positions.

# Notice that the pos dict is passed to each call to draw below

# Draw the graph, but don't color the nodes
nx.draw(G_und, pos, edge_color='k',  with_labels=True,
         font_weight='light', node_size= 280, width= 0.9)

#For each community list, draw the nodes, giving it a specific color.
nx.draw_networkx_nodes(G_und, pos, nodelist=kl_res[0], node_color='b')
nx.draw_networkx_nodes(G_und, pos, nodelist=kl_res[1], node_color='r')
Out[ ]:
<matplotlib.collections.PathCollection at 0x7fb65669b1d0>

MATCHES BETWEEN Best Players

In [ ]:
player_stats.describe()
Out[ ]:
Score Player black_draw black_lost black_win white_draw white_lost white_win total_score total_game_count Avg_Score
count 7274.000000 7274.000000 7274.000000 7274.000000 7274.000000 7274.00000 7274.000000 7274.000000 7274.000000 7274.000000
mean 4313.559527 3.559115 2.631427 1.886170 3.559115 1.88617 2.631427 8.076712 16.153423 0.423910
std 2491.231319 7.169963 3.594243 3.754529 6.672878 2.54663 5.453412 15.386372 26.788221 0.219512
min 1.000000 0.000000 0.000000 0.000000 0.000000 0.00000 0.000000 0.000000 1.000000 0.000000
25% 2147.250000 0.000000 0.000000 0.000000 0.000000 0.00000 0.000000 1.000000 3.000000 0.300000
50% 4319.500000 1.000000 1.000000 1.000000 1.000000 1.00000 1.000000 2.500000 6.000000 0.464286
75% 6463.750000 3.000000 3.000000 2.000000 4.000000 3.00000 3.000000 8.000000 17.000000 0.538462
max 8631.000000 91.000000 33.000000 47.000000 73.000000 26.00000 67.000000 167.500000 280.000000 1.000000
In [ ]:
more_than_fifthy_game = player_stats[player_stats.total_game_count > 50]
In [ ]:
more_than_fifthy_game.describe()
Out[ ]:
Score Player black_draw black_lost black_win white_draw white_lost white_win total_score total_game_count Avg_Score
count 538.000000 538.000000 538.000000 538.000000 538.000000 538.000000 538.000000 538.000000 538.000000 538.000000
mean 4367.490706 23.223048 11.224907 11.890335 22.009294 7.191450 17.375465 51.881970 92.914498 0.549196
std 2546.882627 13.517437 5.486361 6.836278 11.747416 4.183251 10.420056 26.843458 43.004267 0.063819
min 1.000000 5.000000 1.000000 0.000000 5.000000 0.000000 3.000000 19.000000 51.000000 0.363014
25% 2049.500000 14.000000 7.000000 7.000000 14.000000 4.000000 10.000000 32.500000 61.000000 0.510938
50% 4510.500000 19.000000 10.000000 10.000000 19.000000 6.500000 14.500000 43.750000 79.000000 0.559244
75% 6588.250000 29.000000 14.000000 15.000000 26.000000 9.750000 22.000000 63.875000 112.000000 0.590833
max 8629.000000 91.000000 33.000000 47.000000 73.000000 26.000000 67.000000 167.500000 280.000000 0.705882
In [ ]:
more_than_fifthy_game_best = more_than_fifthy_game[more_than_fifthy_game.Avg_Score > 0.590833]
In [ ]:
more_than_fifthy_game_best.describe()
Out[ ]:
Score Player black_draw black_lost black_win white_draw white_lost white_win total_score total_game_count Avg_Score
count 135.000000 135.000000 135.000000 135.000000 135.000000 135.000000 135.000000 135.000000 135.000000 135.000000
mean 4547.762963 27.533333 8.918519 16.192593 24.562963 5.103704 23.659259 65.900000 105.970370 0.623629
std 2561.485227 16.057174 5.368582 7.798293 13.687126 3.339662 11.858093 31.694955 51.553181 0.025242
min 1.000000 5.000000 1.000000 5.000000 6.000000 0.000000 9.000000 31.000000 51.000000 0.590909
25% 2385.500000 16.000000 5.000000 11.000000 14.000000 3.000000 14.000000 39.750000 64.000000 0.600388
50% 4381.000000 24.000000 7.000000 15.000000 20.000000 5.000000 21.000000 57.000000 92.000000 0.620879
75% 6945.000000 37.000000 12.000000 20.000000 31.500000 7.000000 31.000000 83.500000 134.500000 0.637147
max 8616.000000 91.000000 29.000000 47.000000 73.000000 18.000000 62.000000 167.500000 272.000000 0.705882
In [ ]:
best_players = more_than_fifthy_game_best['Player'].unique()

sub_ = train[train['White Player #'].isin(best_players)]
sub_ = sub_[sub_['Black Player #'].isin(best_players)]
sub_.head()
Out[ ]:
Unnamed: 0 Month # White Player # Black Player # Score
110 110 1 2283 2684 1.0
212 212 1 4082 7189 1.0
285 285 1 5254 7106 1.0
476 476 1 8121 753 1.0
547 547 2 1481 4037 0.5
In [ ]:
 match_count_between_best=pd.DataFrame(sub_.groupby(['White Player #','Black Player #'])['Score'].count()).reset_index()
In [ ]:
G = nx.from_pandas_edgelist(match_count_between_best, source='White Player #', target='Black Player #', edge_attr=True, create_using = nx.DiGraph())
In [ ]:
G_und = G.to_undirected(reciprocal=False)
In [ ]:
nx.reciprocity(G)
Out[ ]:
0.32506004803843075
In [ ]:
G_und = G.to_undirected(reciprocal=False)

for u, v, d in G_und.edges(data=True):
    G_und[u][v]['Score'] = 0

for u, v, d in G.edges(data=True):
    G_und[u][v]['Score'] += G[u][v]['Score']
In [ ]:
print(nx.info(G_und))
Name: 
Type: Graph
Number of nodes: 135
Number of edges: 1046
Average degree:  15.4963
In [ ]:
nx.density(G_und)
Out[ ]:
0.11564400221116639
In [ ]:
cliques = list(nx.find_cliques(G_und))
cliques
Out[ ]:
[[2560, 5960, 1746],
 [2560, 3443],
 [1, 2683],
 [1, 76],
 [1, 6110],
 [1538, 3971, 8084],
 [1538, 6770, 5960],
 [1538, 8084, 8415],
 [1538, 8152, 5960, 8190],
 [1538, 8152, 5960, 8415],
 [1538, 8152, 4082],
 [1538, 8152, 870, 8121, 856],
 [1538, 8152, 870, 8121, 8415],
 [1538, 8152, 870, 7948],
 [1538, 956],
 [7189, 6849, 1098, 4082],
 [7189, 6849, 1098, 5531],
 [7189, 6849, 1098, 8190],
 [7189, 6849, 2599, 4082],
 [7189, 6849, 2599, 8190],
 [7189, 1158, 3344, 1098],
 [7189, 1158, 5050, 7286],
 [7189, 3271, 5531, 3824],
 [7189, 3271, 5531, 1098],
 [7189, 3271, 7286],
 [7189, 2599, 3648],
 [7189, 2599, 2683, 8616],
 [7189, 2599, 2683, 8190],
 [7189, 2599, 8616, 4082],
 [7189, 2283, 3648],
 [7189, 2283, 6946],
 [7189, 2283, 2409],
 [7189, 2283, 1098, 8616, 3344],
 [7189, 2283, 1098, 8616, 4082],
 [7189, 2283, 1098, 8616, 2683],
 [7189, 2283, 1098, 8616, 5531],
 [7189, 2283, 1098, 1746, 3344],
 [7189, 2283, 1098, 1746, 4082],
 [7189, 2283, 1098, 1746, 5531],
 [7189, 2283, 1098, 8190, 3344],
 [7189, 2283, 1098, 8190, 2683],
 [7189, 2283, 5050, 8616],
 [7189, 2283, 5050, 1746],
 [7189, 8214, 3648],
 [7189, 8214, 1746, 5531],
 [7189, 8214, 8190],
 [7189, 7286, 8616, 5050],
 [7189, 2015, 8616],
 [7189, 2015, 1746],
 [8214, 3648, 2997],
 [8214, 4931, 5531],
 [8214, 4931, 8190, 8152, 3117],
 [8214, 4931, 8190, 8152, 5942],
 [8214, 4931, 8190, 6691],
 [8214, 3523, 7761],
 [8214, 3523, 6691],
 [8214, 3013, 8152, 7528],
 [8214, 3013, 8152, 8190],
 [8214, 3013, 8341],
 [8214, 3013, 2997],
 [8214, 4037, 6691, 2256, 5333],
 [8214, 4037, 6691, 2256, 8190],
 [8214, 4037, 6691, 6586, 5333],
 [8214, 4037, 6691, 2295, 8190],
 [8214, 4037, 7528],
 [8214, 4037, 1782, 7228],
 [8214, 4037, 1782, 8190],
 [8214, 4037, 5942, 8190],
 [8214, 4037, 5531, 5333],
 [8214, 4037, 7228, 5333],
 [8214, 4037, 5598, 2256],
 [8214, 4037, 5598, 2295],
 [8214, 7107, 8152, 8121],
 [8214, 7107, 8152, 5942],
 [8214, 7107, 2997, 8121],
 [8214, 7107, 2997, 1746, 1782],
 [8214, 7107, 2997, 1746, 5942],
 [8214, 7107, 2997, 6691],
 [8214, 1964, 5333, 5531],
 [8214, 1964, 5333, 7228],
 [8214, 1964, 5598],
 [8214, 1964, 8190],
 [8214, 3117, 2256, 8190],
 [8214, 3117, 1746],
 [8214, 3117, 6110],
 [8214, 7761, 2256],
 [8214, 7761, 2362],
 [8214, 1746, 6586],
 [8214, 1746, 5598, 2295],
 [8214, 8341, 2256],
 [8214, 2997, 2256, 6691, 5333],
 [8214, 2997, 7228, 8121],
 [8214, 2997, 7228, 5333],
 [8214, 2997, 7228, 1782],
 [8214, 8152, 7228, 8121],
 [8214, 2362, 8190],
 [8214, 6110, 6586],
 [2599, 6880, 2957],
 [2599, 6880, 7134, 8246],
 [2599, 6880, 7134, 2683, 8190],
 [2599, 6880, 7134, 5942, 6685],
 [2599, 6880, 7134, 5942, 8190],
 [2599, 7106, 4920, 8190],
 [2599, 7106, 4037, 7228],
 [2599, 7106, 4037, 8190],
 [2599, 4037, 1481, 2683],
 [2599, 4037, 7228, 5333],
 [2599, 4037, 7228, 1782],
 [2599, 4037, 8190, 6849, 1782],
 [2599, 4037, 8190, 6849, 5942],
 [2599, 4037, 8190, 2683],
 [2599, 1481, 7107, 2683],
 [2599, 1481, 7107, 2957],
 [2599, 4073, 7134, 5942, 8190],
 [2599, 2699],
 [2599, 1964, 6849, 7134, 8190],
 [2599, 1964, 7228, 5333],
 [2599, 4331, 1148],
 [2599, 4331, 5333, 7228],
 [2599, 4331, 5942],
 [2599, 6770, 4920, 7593],
 [2599, 6770, 6849, 3013],
 [2599, 7412, 4920],
 [2599, 7412, 7228],
 [2599, 2997, 3648],
 [2599, 2997, 6849, 4082],
 [2599, 2997, 6849, 7134, 3013],
 [2599, 2997, 6849, 7134, 5942],
 [2599, 2997, 6849, 1782],
 [2599, 2997, 7107, 7848, 7593],
 [2599, 2997, 7107, 7593, 7134, 6685, 5942],
 [2599, 2997, 7107, 8616, 4082, 6685],
 [2599, 2997, 7107, 8616, 7134, 8121],
 [2599, 2997, 7107, 8616, 7134, 2683],
 [2599, 2997, 7107, 8616, 7134, 6685, 5942],
 [2599, 2997, 7107, 1782],
 [2599, 2997, 5333, 7593],
 [2599, 2997, 5333, 7228],
 [2599, 2997, 8246, 8616, 7134],
 [2599, 2997, 7228, 8121],
 [2599, 2997, 7228, 1782],
 [2599, 4920, 3648],
 [2599, 4920, 7593, 8190],
 [2599, 1148, 8616, 8121],
 [2599, 1148, 8190, 7593],
 [2599, 1148, 8190, 1782],
 [2599, 8190, 7848, 7593],
 [2599, 8190, 7134, 6849, 3013],
 [2599, 8190, 7134, 6849, 5942],
 [2599, 8190, 7134, 7593, 5942],
 [3117, 391, 6235],
 [3117, 391, 1098, 2256, 8190, 7134],
 [3117, 391, 1098, 2256, 8190, 2479],
 [3117, 391, 1098, 1746, 7134],
 [3117, 391, 4931, 8190, 2479],
 [3117, 8084, 1098, 2256, 2479],
 [3117, 8084, 1098, 1746],
 [3117, 8152, 4931, 8190, 2479],
 [3117, 8152, 6235],
 [3117, 2684],
 [3117, 8605, 1098],
 [3117, 6110, 6235],
 [3117, 6110, 2479],
 [64, 4481, 6849, 8152, 4082],
 [64, 4481, 6849, 8152, 5942],
 [64, 4481, 6849, 8152, 2479],
 [64, 4481, 6849, 6691, 4082],
 [64, 4481, 6849, 6691, 8084],
 [64, 4481, 6849, 6691, 4037],
 [64, 4481, 6849, 5942, 4037],
 [64, 4481, 6849, 2479, 8084],
 [64, 4481, 6849, 2479, 4037],
 [64, 4481, 4931, 8152, 4082],
 [64, 4481, 4931, 8152, 5942],
 [64, 4481, 4931, 8152, 2479],
 [64, 4481, 4931, 5050, 6691],
 [64, 4481, 4931, 6691, 4082],
 [64, 4481, 8616, 2479, 8084],
 [64, 4481, 8616, 4082],
 [64, 4481, 8616, 8246],
 [64, 4481, 8616, 5942],
 [64, 4481, 8616, 5050],
 [64, 4481, 7593, 6691],
 [64, 4481, 7593, 5942],
 [64, 4481, 5050, 7228],
 [64, 4481, 7228, 8152],
 [64, 4481, 7228, 4037],
 [64, 6849, 6691, 5960],
 [64, 6849, 6691, 2997, 4082],
 [64, 6849, 6691, 2997, 8084],
 [64, 6849, 6691, 2295, 4037],
 [64, 6849, 2479, 5960, 8152],
 [64, 6849, 2479, 2997, 8084, 1782],
 [64, 6849, 2479, 1782, 4037],
 [64, 6849, 2479, 2295, 4037],
 [64, 6849, 2479, 5531, 8084],
 [64, 6849, 2479, 5531, 4037],
 [64, 6849, 5942, 4634, 4037],
 [64, 6849, 5942, 4634, 7134],
 [64, 6849, 5942, 2997, 7134],
 [64, 6849, 4634, 2295, 4037],
 [64, 6849, 7134, 5960],
 [64, 5602, 8152],
 [64, 5602, 2283],
 [64, 6054, 2581],
 [64, 391, 7106, 5531, 4037],
 [64, 391, 7106, 7228, 5050],
 [64, 391, 7106, 7228, 4037],
 [64, 391, 6691, 4931, 5960],
 [64, 391, 6691, 4931, 4082],
 [64, 391, 6691, 4931, 5050],
 [64, 391, 6691, 7107, 7848],
 [64, 391, 6691, 7107, 4082],
 [64, 391, 6691, 7107, 5960],
 [64, 391, 6691, 4037, 2295],
 [64, 391, 6691, 2295, 7848],
 [64, 391, 3971, 4931, 2283],
 [64, 391, 4931, 5960, 2479],
 [64, 391, 4931, 2283, 5942],
 [64, 391, 4931, 2283, 5050],
 [64, 391, 4931, 2283, 5531],
 [64, 391, 4931, 2283, 4082],
 [64, 391, 4931, 8287, 5050],
 [64, 391, 4931, 8287, 4082],
 [64, 391, 4931, 2479, 5531],
 [64, 391, 1286, 5960, 1746, 7107, 7134],
 [64, 391, 1286, 5960, 2479],
 [64, 391, 1286, 2283, 1746, 7107, 7848],
 [64, 391, 1286, 2283, 1746, 7107, 4082],
 [64, 391, 1286, 2283, 1746, 7107, 2581],
 [64, 391, 1286, 2283, 1746, 7107, 5942],
 [64, 391, 1286, 2283, 1746, 3344, 2295],
 [64, 391, 1286, 2283, 1746, 2295, 7848],
 [64, 391, 1286, 2283, 1746, 2295, 2581],
 [64, 391, 1286, 2283, 1746, 5050],
 [64, 391, 1286, 2283, 1746, 5531],
 [64, 391, 1286, 2283, 6946, 4037, 2295],
 [64, 391, 1286, 2283, 4037, 5531],
 [64, 391, 1286, 2283, 4037, 5942],
 [64, 391, 1286, 2283, 4037, 2295, 3344],
 [64, 391, 1286, 2283, 4037, 2295, 2581],
 [64, 391, 1286, 2479, 8121],
 [64, 391, 1286, 2479, 4037, 3344, 2295],
 [64, 391, 1286, 2479, 4037, 5531],
 [64, 391, 1286, 8121, 7107, 7134],
 [64, 391, 1286, 8121, 7107, 8287],
 [64, 391, 1286, 7134, 1746, 3344],
 [64, 391, 1286, 7134, 1746, 5050],
 [64, 391, 1286, 7134, 1746, 7107, 5942],
 [64, 391, 1286, 8287, 5050],
 [64, 391, 1286, 8287, 4082, 7107],
 [64, 391, 1286, 8287, 7107, 7848],
 [64, 391, 1286, 8287, 2295, 7848],
 [64, 391, 1286, 8287, 2295, 4037, 3344],
 [64, 391, 1286, 8287, 2295, 4037, 6946],
 [64, 391, 1782, 1746, 7107],
 [64, 391, 1782, 7107, 8287],
 [64, 391, 1782, 4037, 2479],
 [64, 391, 1782, 4037, 7228],
 [64, 391, 1782, 4037, 8287],
 [64, 391, 7228, 5960],
 [64, 391, 7228, 8121],
 [64, 391, 7228, 2283, 5050],
 [64, 391, 7228, 2283, 6946, 4037],
 [64, 8616, 3971, 2283],
 [64, 8616, 3971, 8084],
 [64, 8616, 3971, 6685],
 [64, 8616, 1286, 2283, 7107, 4082],
 [64, 8616, 1286, 2283, 7107, 2683],
 [64, 8616, 1286, 2283, 7107, 2581],
 [64, 8616, 1286, 2283, 7107, 5942],
 [64, 8616, 1286, 2283, 3344, 2295],
 [64, 8616, 1286, 2283, 2295, 2581],
 [64, 8616, 1286, 2283, 5050],
 [64, 8616, 1286, 2283, 5531],
 [64, 8616, 1286, 2479, 8121],
 [64, 8616, 1286, 2479, 158, 3344, 2295],
 [64, 8616, 1286, 2479, 158, 5531],
 [64, 8616, 1286, 7134, 3344, 158],
 [64, 8616, 1286, 7134, 5050],
 [64, 8616, 1286, 7134, 7107, 8121],
 [64, 8616, 1286, 7134, 7107, 2683],
 [64, 8616, 1286, 7134, 7107, 5942],
 [64, 8616, 1286, 158, 4082],
 [64, 8616, 8084, 7107, 2997],
 [64, 8616, 8084, 2479, 3344],
 [64, 8616, 8084, 2479, 5531],
 [64, 8616, 8084, 2479, 2997],
 [64, 8616, 2997, 7107, 4082, 6685],
 [64, 8616, 2997, 7107, 2581],
 [64, 8616, 2997, 7107, 7134, 8121],
 [64, 8616, 2997, 7107, 7134, 2683],
 [64, 8616, 2997, 7107, 7134, 6685, 5942],
 [64, 8616, 2997, 8246, 7134],
 [64, 8616, 2997, 2479, 8121],
 [64, 8616, 6685, 5050, 7134],
 [64, 7593, 6946, 8287, 2997],
 [64, 7593, 6946, 8287, 2295],
 [64, 7593, 7107, 5960, 6691],
 [64, 7593, 7107, 5960, 6685, 7134],
 [64, 7593, 7107, 2997, 7848, 6691],
 [64, 7593, 7107, 2997, 7848, 8287],
 [64, 7593, 7107, 2997, 7134, 6685, 5942],
 [64, 7593, 3344, 7134],
 [64, 7593, 3344, 8287, 2295],
 [64, 7593, 2295, 7848, 6691],
 [64, 7593, 2295, 7848, 8287],
 [64, 7593, 5531],
 [64, 3824, 5531],
 [64, 8084, 7106, 5531],
 [64, 8084, 6691, 7107, 2997],
 [64, 8084, 6691, 7412],
 [64, 8084, 1746, 3344],
 [64, 8084, 1746, 7107, 2997, 1782],
 [64, 8084, 1746, 5531],
 [64, 8084, 7412, 3344],
 [64, 2997, 6946, 7228],
 [64, 2997, 7107, 6691, 4082],
 [64, 2997, 7107, 6691, 2683],
 [64, 2997, 7107, 7848, 1746],
 [64, 2997, 7107, 1746, 7134, 5942],
 [64, 2997, 7107, 1746, 4082],
 [64, 2997, 7107, 1746, 2581],
 [64, 2997, 7107, 1782, 8287],
 [64, 2997, 7107, 8287, 8121],
 [64, 2997, 7107, 8287, 4082],
 [64, 2997, 7107, 8287, 2683],
 [64, 2997, 7228, 8121],
 [64, 2997, 7228, 1782],
 [64, 7412, 3344, 1286, 8287],
 [64, 7412, 5050, 6691],
 [64, 7412, 5050, 7228],
 [64, 7412, 5050, 1286, 8287],
 [64, 7412, 8152, 7228],
 [64, 8152, 6946, 7228],
 [64, 8152, 7107, 7848],
 [64, 8152, 7107, 5960],
 [64, 8152, 7107, 4082],
 [64, 8152, 7107, 5942],
 [64, 8152, 7107, 8121],
 [64, 8152, 5960, 4931, 2479],
 [64, 8152, 5960, 7228],
 [64, 8152, 8121, 7228],
 [64, 8152, 8121, 2479],
 [64, 4634, 3971],
 [64, 4634, 1286, 6946, 4037, 2295],
 [64, 4634, 1286, 7107, 7134, 8121],
 [64, 4634, 1286, 7107, 7134, 2683],
 [64, 4634, 1286, 7107, 7134, 5942],
 [64, 4634, 1286, 4037, 2683],
 [64, 4634, 1286, 4037, 5942],
 [64, 2683, 7107, 1286, 8287],
 [64, 2683, 4037, 6691],
 [64, 2683, 4037, 1286, 2283],
 [64, 2683, 4037, 1286, 8287],
 [64, 956, 5050],
 [64, 158, 1782, 2479],
 [64, 158, 1782, 7228],
 [64, 158, 1782, 8287],
 [64, 158, 7228, 5960],
 [64, 158, 1286, 5960, 7134],
 [64, 158, 1286, 5960, 2479],
 [64, 158, 1286, 7848, 8287, 2295],
 [64, 158, 1286, 8287, 3344, 2295],
 [64, 158, 1286, 8287, 4082],
 [3648, 7504, 2283],
 [4162, 898, 2283],
 [4162, 898, 2979],
 [4162, 2581, 2283],
 [4162, 2581, 2979],
 [6212, 3488, 6586],
 [6212, 3488, 956],
 [6212, 7593, 4694],
 [6212, 6458, 7286],
 [6212, 2256, 1736, 8084],
 [6212, 2256, 6049],
 [6212, 2256, 4082],
 [6212, 6586, 4694],
 [6212, 7412, 6049],
 [6212, 7412, 5050],
 [6212, 7412, 8084],
 [6212, 7286, 5050],
 [6212, 5050, 956],
 [6212, 2683],
 [6212, 8415, 1736, 8084],
 [1098, 6944, 6849, 4481],
 [1098, 6944, 6849, 8190],
 [1098, 6944, 7559, 3184],
 [1098, 6944, 7559, 943],
 [1098, 6944, 7412],
 [1098, 4481, 6849, 6691, 4082],
 [1098, 4481, 6849, 6691, 8084],
 [1098, 4481, 6849, 6691, 4037],
 [1098, 4481, 6849, 5942, 4037],
 [1098, 4481, 6849, 2479, 8084],
 [1098, 4481, 6849, 2479, 4037],
 [1098, 4481, 8616, 4082],
 [1098, 4481, 8616, 8084, 2479],
 [1098, 4481, 8616, 5942],
 [1098, 4481, 1736, 2479, 8084],
 [1098, 4481, 1736, 2479, 4037],
 [1098, 4481, 7504, 8084],
 [1098, 4481, 4920],
 [1098, 6849, 8084, 5531, 2479],
 [1098, 6849, 8084, 1782, 2479],
 [1098, 6849, 4037, 5531, 2479],
 [1098, 6849, 4037, 8190, 1782, 2479],
 [1098, 6849, 4037, 8190, 5942],
 [1098, 6849, 4037, 8190, 2295, 6691, 2013],
 [1098, 6849, 4037, 8190, 2295, 2479],
 [1098, 6849, 7134, 5942, 8190],
 [1098, 1158, 7504],
 [1098, 1158, 3184],
 [1098, 1158, 4037, 3805, 2581],
 [1098, 1158, 4037, 2295, 1736],
 [1098, 1158, 4037, 2295, 3344],
 [1098, 1158, 4037, 2295, 2581],
 [1098, 391, 6691, 4082, 2256],
 [1098, 391, 6691, 4082, 7107],
 [1098, 391, 6691, 7107, 7848],
 [1098, 391, 6691, 8190, 7848, 2295],
 [1098, 391, 6691, 8190, 4037, 2256],
 [1098, 391, 6691, 8190, 4037, 2013, 2295],
 [1098, 391, 5598, 1746, 2295],
 [1098, 391, 5598, 4037, 2256],
 [1098, 391, 5598, 4037, 3805],
 [1098, 391, 5598, 4037, 2295],
 [1098, 391, 2283, 4037, 5531, 3805],
 [1098, 391, 2283, 4037, 3805, 2581],
 [1098, 391, 2283, 4037, 5942, 8190],
 [1098, 391, 2283, 4037, 2295, 2581],
 [1098, 391, 2283, 4037, 2295, 8190, 1736],
 [1098, 391, 2283, 4037, 2295, 8190, 3344],
 [1098, 391, 2283, 4037, 2295, 8190, 2013],
 [1098, 391, 2283, 1736, 7107],
 [1098, 391, 2283, 1746, 7107, 7848],
 [1098, 391, 2283, 1746, 7107, 4082],
 [1098, 391, 2283, 1746, 7107, 2581],
 [1098, 391, 2283, 1746, 7107, 5942],
 [1098, 391, 2283, 1746, 3344, 2295],
 [1098, 391, 2283, 1746, 7504],
 [1098, 391, 2283, 1746, 2295, 7848],
 [1098, 391, 2283, 1746, 2295, 2581],
 [1098, 391, 2283, 1746, 2295, 2013],
 [1098, 391, 2283, 1746, 5531],
 [1098, 391, 2283, 3443, 8190],
 [1098, 391, 2283, 8190, 7848, 2295],
 [1098, 391, 2479, 8121],
 [1098, 391, 2479, 3443, 8190],
 [1098, 391, 2479, 4037, 5531],
 [1098, 391, 2479, 4037, 8190, 1736, 2256],
 [1098, 391, 2479, 4037, 8190, 1736, 2295],
 [1098, 391, 2479, 4037, 8190, 3344, 2256],
 [1098, 391, 2479, 4037, 8190, 3344, 2295],
 [1098, 391, 2479, 4037, 8190, 1782],
 [1098, 391, 2256, 7504],
 [1098, 391, 2256, 7134, 8190, 1736],
 [1098, 391, 2256, 7134, 8190, 3344],
 [1098, 391, 1782, 1746, 7107],
 [1098, 391, 8121, 7107, 7134],
 [1098, 391, 7134, 1746, 3344],
 [1098, 391, 7134, 1746, 7107, 5942],
 [1098, 391, 7134, 7107, 1736],
 [1098, 391, 7134, 8190, 3443],
 [1098, 391, 7134, 8190, 5942],
 [1098, 7559, 4719],
 [1098, 8616, 7107, 8121, 7134],
 [1098, 8616, 7107, 2283, 4082],
 [1098, 8616, 7107, 2283, 2683],
 [1098, 8616, 7107, 2283, 2581],
 [1098, 8616, 7107, 2283, 5942],
 [1098, 8616, 7107, 8084],
 [1098, 8616, 7107, 7134, 2683],
 [1098, 8616, 7107, 7134, 5942],
 [1098, 8616, 2479, 3344, 8084],
 [1098, 8616, 2479, 3344, 2295],
 [1098, 8616, 2479, 8121],
 [1098, 8616, 2479, 5531, 8084],
 [1098, 8616, 3344, 2283, 2295],
 [1098, 8616, 3344, 7134],
 [1098, 8616, 2295, 2283, 2581],
 [1098, 8616, 2295, 5598],
 [1098, 8616, 5598, 8084],
 [1098, 3271, 5942],
 [1098, 3271, 2479, 1736, 2256],
 [1098, 3271, 2479, 5531],
 [1098, 3271, 2479, 1782],
 [1098, 7528, 4037],
 [1098, 943, 7504],
 [1098, 943, 2479],
 [1098, 4719, 3805, 8605],
 [1098, 3184, 6691, 2683],
 [1098, 3184, 5598],
 [1098, 3184, 5942],
 [1098, 3184, 2479],
 [1098, 8084, 7107, 1736],
 [1098, 8084, 7107, 1746, 1782],
 [1098, 8084, 7107, 6691],
 [1098, 8084, 2256, 7504],
 [1098, 8084, 2256, 6691],
 [1098, 8084, 2256, 5598],
 [1098, 8084, 2256, 2479, 1736],
 [1098, 8084, 2256, 2479, 3344],
 [1098, 8084, 1746, 3344],
 [1098, 8084, 1746, 7504],
 [1098, 8084, 1746, 5531],
 [1098, 8084, 1746, 5598],
 [1098, 8084, 7412, 3344],
 [1098, 8084, 7412, 6691],
 [1098, 8084, 5531, 3805],
 [1098, 8084, 3805, 5598],
 [1098, 7412, 4920],
 [1098, 4920, 8190],
 [1098, 2683, 7107, 6691],
 [1098, 2683, 4037, 3805, 2283],
 [1098, 2683, 4037, 8190, 6691],
 [1098, 2683, 4037, 8190, 2283],
 [1098, 2683, 7134, 8190],
 [1098, 2683, 8605, 3805],
 [1098, 8605, 7504],
 [1098, 8605, 8121],
 [1098, 8605, 5598, 3805],
 [1098, 8605, 5598, 2295],
 [76, 3488, 4931],
 [76, 3488, 943],
 [76, 3184],
 [76, 7761, 8287],
 [76, 6770],
 [76, 5333, 7228],
 [76, 8287, 4931],
 [1100, 4419],
 [1100, 8580],
 [1100, 1852],
 [1105, 8580],
 [1105, 4037, 7228],
 [1105, 4037, 5254],
 [1105, 652],
 [1105, 7482, 956],
 [7761, 1481],
 [7761, 1178],
 [7761, 2581],
 [4694, 5254],
 [4694, 7593, 6770],
 [4694, 7593, 501],
 [4694, 7593, 7134],
 [4694, 7948],
 [4694, 6586, 501],
 [4694, 6586, 7134],
 [4694, 2684],
 [6235, 4073],
 [6235, 8121, 8152],
 [6235, 8121, 391],
 [6235, 3805, 391],
 [6235, 3805, 4719],
 [4719, 1178],
 [4719, 956],
 [4719, 8415],
 [3184, 6049, 6691, 2997],
 [3184, 6049, 1158],
 [3184, 6586, 6691],
 [3184, 6586, 1852],
 [3184, 1852, 6944],
 [3184, 2997, 2683, 6691],
 [3184, 2997, 5942],
 [3184, 2997, 2479],
 [6770, 5960, 6849],
 [6770, 5960, 7593],
 [6770, 5960, 3980],
 [6770, 4481, 4920, 7593],
 [6770, 4481, 3013, 1736],
 [6770, 4481, 3013, 6849],
 [6770, 7986],
 [7286, 5050, 8616, 1148],
 [7286, 5050, 4331, 1148],
 [7286, 5050, 4331, 1158],
 [7286, 4419],
 [7286, 3971, 8616],
 [7286, 3971, 4331],
 [7286, 6458, 8616, 1148],
 [7286, 6458, 1158],
 [2684, 3523, 7412],
 [2684, 1964, 1158],
 [2684, 2957, 1852],
 [2684, 4082, 8616, 2283],
 [2684, 4082, 8616, 2997],
 [2684, 4082, 1852],
 [2684, 2997, 8616, 2015],
 [2684, 2997, 2013],
 [2684, 5050, 1158, 4331],
 [2684, 5050, 8616, 2283],
 [2684, 5050, 8616, 1148],
 [2684, 5050, 4331, 1148],
 [2684, 5050, 7412],
 [2684, 5050, 1852],
 [2684, 2013, 2283],
 [1148, 6691, 5960, 7593, 8190],
 [1148, 6691, 5050, 4331],
 [1148, 1736, 8190],
 [1148, 2581, 8616],
 [2173, 4331],
 [2173, 8341],
 [2173, 3271, 3824],
 [2173, 3271, 8133],
 [2173, 3271, 501, 8287],
 [2689, 3980, 3488],
 [2689, 3980, 2479],
 [5254, 6849, 8084],
 [5254, 6849, 4037],
 [5254, 7106, 8084],
 [5254, 7106, 4037],
 [5254, 7106, 4286],
 [5254, 4931, 3944],
 [5254, 3944, 4037],
 [5254, 6899],
 [5254, 1178],
 [5254, 2015],
 [1158, 5050, 3805, 8287],
 [1158, 6049, 2295],
 [1158, 4331, 3344],
 [1158, 1964, 7504],
 [1158, 8287, 4037, 3805],
 [1158, 8287, 4037, 2295, 1736],
 [1158, 8287, 4037, 2295, 3344],
 [2699, 7482],
 [2699, 8084],
 [652, 3944, 6458],
 [652, 8152, 2479],
 [652, 7504],
 [8341, 4286],
 [1178, 4073],
 [4286, 7528],
 [4286, 4481],
 [4286, 4419],
 [4286, 8415],
 [7362, 856],
 [7362, 4037],
 [7362, 956],
 [7362, 3824],
 [3271, 1286, 1736, 2479],
 [3271, 1286, 1736, 8287],
 [3271, 1286, 5531, 8133],
 [3271, 1286, 5531, 2479],
 [3271, 1286, 5942],
 [3271, 501, 6586],
 [3271, 1782, 8287],
 [3271, 6586, 8133],
 [1736, 3013, 7134, 8190],
 [1736, 6054],
 [1736, 1286, 158, 7134],
 [1736, 1286, 158, 2295, 8287],
 [1736, 1286, 158, 2295, 2479],
 [1736, 1286, 391, 7107, 2283],
 [1736, 1286, 391, 7107, 7134],
 [1736, 1286, 391, 7107, 8287],
 [1736, 1286, 391, 8190, 4037, 2295, 2283],
 [1736, 1286, 391, 8190, 4037, 2295, 8287],
 [1736, 1286, 391, 8190, 4037, 2295, 2479],
 [1736, 1286, 391, 8190, 7134],
 [1736, 7375, 7107, 2283],
 [1736, 6110, 4481, 2479],
 [7375, 2283, 7504],
 [7375, 2283, 898],
 [7375, 3983],
 [2256, 5333, 7504, 8084],
 [2256, 5333, 7504, 391],
 [2256, 5333, 6691, 8084, 2997],
 [2256, 5333, 6691, 391, 4037],
 [2256, 6049, 2997, 6691],
 [2256, 6049, 2997, 7134],
 [2256, 2997, 4082, 6691],
 [2256, 2997, 8084, 2479],
 [5333, 391, 4331, 5050, 6691],
 [5333, 391, 4331, 5050, 7228],
 [5333, 391, 4331, 3971],
 [5333, 391, 5531, 4037],
 [5333, 391, 4037, 7228],
 [5333, 3944, 4037],
 [5333, 7593, 6691, 2997],
 [5333, 7593, 5531],
 [5333, 1964, 7504],
 [5333, 1964, 6993],
 [5333, 8084, 3971],
 [5333, 8084, 5531],
 [3805, 391, 5050, 2283],
 [3805, 391, 5050, 8287],
 [3805, 391, 3971, 2283],
 [3805, 391, 4037, 6946, 2283],
 [3805, 391, 4037, 6946, 8287],
 [3805, 7593, 6946, 8287],
 [3805, 7593, 5531],
 [3805, 3824, 5531],
 [3805, 8084, 3971],
 [3805, 4634, 3971],
 [3805, 4634, 4037, 6946],
 [3805, 4634, 4037, 2683],
 [3805, 2683, 8287, 4037],
 [3805, 8605, 5050],
 [8415, 3824, 4073],
 [8415, 6849, 5960, 8152],
 [8415, 6849, 8084],
 [8415, 7228, 8152, 5960],
 [8415, 7228, 8152, 8121],
 [8415, 4073, 5960],
 [8415, 4073, 8084],
 [6880, 6049, 6691],
 [6880, 6049, 2957],
 [6880, 6049, 7134],
 [6880, 6691, 8190, 2683],
 [6880, 6691, 8190, 2013],
 [6880, 5002],
 [6880, 7986],
 [6880, 2013, 6685],
 [4331, 391, 6946, 7228],
 [4331, 391, 1746, 3344],
 [4331, 391, 1746, 898],
 [4331, 391, 1746, 5050],
 [4331, 391, 1746, 5942],
 [753, 5960],
 [753, 3344, 2283],
 [753, 3344, 501],
 [753, 8121],
 [753, 1782],
 [7948, 4037],
 [7948, 6054, 870],
 [7948, 6993],
 [7948, 6110],
 [7948, 2015],
 [5914, 7482],
 [4381, 3488, 1852, 943],
 [4381, 3488, 3980],
 [4381, 3488, 7134],
 [4381, 6049, 7134],
 [4381, 3443, 7134],
 [6944, 4931, 4481],
 [6944, 4931, 1852],
 [6944, 4931, 8190],
 [6944, 1852, 943],
 [6944, 3013, 6849, 4481],
 [6944, 3013, 6849, 8190],
 [6944, 6119],
 [2362, 2979],
 [2362, 501, 8190],
 [6458, 6849],
 [1852, 4931, 3488],
 [1852, 4931, 3944],
 [1852, 4931, 2957],
 [1852, 4931, 391, 5050],
 [1852, 4931, 391, 4082],
 [1852, 1286, 3488],
 [1852, 1286, 2957],
 [1852, 1286, 391, 5050],
 [1852, 1286, 391, 4082],
 [1852, 3983, 3944],
 [1852, 7504, 391],
 [1852, 7504, 943],
 [1852, 943, 2957],
 [1852, 6586, 3488],
 [1852, 956, 3488],
 [1852, 956, 5050],
 [7482, 3944],
 [7482, 2479, 8616, 8121],
 [7482, 2479, 8190],
 [4419, 7593],
 [4419, 3013],
 [4419, 391, 1782],
 [7504, 4073, 8084],
 [7504, 4073, 943],
 [7504, 3013, 4481],
 [6993, 3344],
 [6993, 4931],
 [6993, 7107, 2683],
 [856, 3344],
 [856, 6110],
 [7528, 956],
 [3944, 7412],
 [3443, 6685, 7134],
 [3443, 8190, 1964, 7134],
 [3443, 8190, 391, 4931, 2283],
 [3443, 8190, 391, 4931, 2479],
 [3443, 8190, 391, 1286, 2283],
 [3443, 8190, 391, 1286, 7134],
 [3443, 8190, 391, 1286, 2479],
 [898, 8616, 2283],
 [898, 391, 1746, 2283],
 [898, 391, 8287],
 [7559, 5050],
 [7559, 2957, 943],
 [5002, 5960],
 [3980, 3488, 6586],
 [3980, 3488, 4931],
 [3980, 3488, 1286],
 [3980, 5602],
 [3980, 6691, 5960, 4931],
 [3980, 6691, 6586, 501],
 [3980, 1286, 5960, 2479],
 [3980, 2479, 4931, 5960],
 [3980, 2479, 1782],
 [2957, 4931, 5960],
 [2957, 4931, 3971],
 [2957, 3971, 8084],
 [2957, 7107, 5960, 1286],
 [2957, 7107, 6049, 1481],
 [2957, 7107, 8084],
 [6040, 6849, 3013, 8152, 4481],
 [6040, 6849, 3013, 2997],
 [8605, 7228, 8121],
 [8605, 7228, 5050],
 [8605, 1286, 8121],
 [8605, 1286, 5050],
 [8605, 1286, 2683],
 [8605, 1286, 2295],
 [3488, 1746, 7134, 6586],
 [3488, 1746, 7134, 1286],
 [3488, 6119],
 [6049, 6691, 6849, 4481],
 [6049, 6691, 6849, 2997],
 [6049, 6691, 6849, 2295],
 [6049, 6691, 7107, 2997],
 [6049, 6691, 7412],
 [6049, 6691, 4073],
 [6049, 7228, 4481],
 [6049, 7228, 7412],
 [6049, 7228, 2997],
 [6049, 7134, 4073],
 [6049, 7134, 2997, 6849],
 [6049, 7134, 2997, 7107],
 [2979, 6946],
 [1964, 6946, 7228],
 [1964, 5531, 6849],
 [943, 4073, 2479],
 [6586, 7106, 4037],
 [6586, 7848, 1746],
 [6586, 7848, 6691],
 [6586, 2581, 1746],
 [6586, 2581, 4037],
 [6586, 2015, 1746],
 [3523, 6691, 7412],
 [8133, 6849, 4634],
 [8133, 6849, 5531, 8084],
 [8133, 5050, 1286],
 [8133, 1286, 4634],
 [3013, 6849, 8152, 8190],
 [1481, 4634, 2683, 7107],
 [1481, 4634, 2683, 4037],
 [2013, 6691, 2997, 6849],
 [2013, 6691, 2997, 7593],
 [2013, 6691, 8190, 4073],
 [2013, 6691, 8190, 7593, 2295],
 [2013, 1746, 2997],
 [2013, 6685, 7593, 2997],
 [2013, 6110],
 [2015, 7107, 8616, 2997],
 [2015, 7107, 1746, 2997],
 [2015, 7107, 1746, 391],
 [8158, 956],
 [6119, 6946, 2295],
 [4073, 5050, 6691],
 [4073, 5050, 7134],
 [4073, 8084, 6691],
 [4073, 8084, 2479],
 [4073, 8190, 5960, 6691],
 [4073, 8190, 5960, 7134],
 [4073, 8190, 5960, 2479],
 [501, 7593, 8190, 3344, 8287],
 [501, 7593, 8190, 6691],
 [8190, 6849, 5960, 8152, 2479],
 [8190, 6849, 5960, 6691],
 [8190, 6849, 5960, 7134],
 [8190, 6849, 8152, 5942],
 [8190, 391, 7106, 4037],
 [8190, 391, 6691, 5960, 4931],
 [8190, 391, 4931, 5960, 2479],
 [8190, 391, 4931, 5942, 2283],
 [8190, 391, 4931, 8287],
 [8190, 391, 1286, 7848, 2295, 2283],
 [8190, 391, 1286, 7848, 2295, 8287],
 [8190, 391, 1286, 5960, 7134],
 [8190, 391, 1286, 5960, 2479],
 [8190, 391, 1286, 4037, 3344, 2295, 2283],
 [8190, 391, 1286, 4037, 3344, 2295, 8287],
 [8190, 391, 1286, 4037, 3344, 2295, 2479],
 [8190, 391, 1286, 4037, 5942, 2283],
 [8190, 391, 1286, 7134, 3344],
 [8190, 391, 1286, 7134, 5942],
 [8190, 391, 1782, 8287, 4037],
 [8190, 7593, 5960, 7134],
 [8190, 7593, 7134, 3344],
 [8190, 7593, 2295, 7848, 6691],
 [8190, 7593, 2295, 7848, 8287],
 [8190, 7593, 2295, 3344, 8287],
 [8190, 8152, 7848],
 [8190, 8152, 4931, 5960, 2479],
 [8190, 2683, 4037, 1286, 2283],
 [8190, 2683, 4037, 1286, 8287],
 [8190, 2683, 7134, 1286]]
In [ ]:
cliques_gt5= [x for x in cliques if len(x)>5]
cliques_gt5
Out[ ]:
[[2599, 2997, 7107, 7593, 7134, 6685, 5942],
 [2599, 2997, 7107, 8616, 4082, 6685],
 [2599, 2997, 7107, 8616, 7134, 8121],
 [2599, 2997, 7107, 8616, 7134, 2683],
 [2599, 2997, 7107, 8616, 7134, 6685, 5942],
 [3117, 391, 1098, 2256, 8190, 7134],
 [3117, 391, 1098, 2256, 8190, 2479],
 [64, 6849, 2479, 2997, 8084, 1782],
 [64, 391, 1286, 5960, 1746, 7107, 7134],
 [64, 391, 1286, 2283, 1746, 7107, 7848],
 [64, 391, 1286, 2283, 1746, 7107, 4082],
 [64, 391, 1286, 2283, 1746, 7107, 2581],
 [64, 391, 1286, 2283, 1746, 7107, 5942],
 [64, 391, 1286, 2283, 1746, 3344, 2295],
 [64, 391, 1286, 2283, 1746, 2295, 7848],
 [64, 391, 1286, 2283, 1746, 2295, 2581],
 [64, 391, 1286, 2283, 1746, 5050],
 [64, 391, 1286, 2283, 1746, 5531],
 [64, 391, 1286, 2283, 6946, 4037, 2295],
 [64, 391, 1286, 2283, 4037, 5531],
 [64, 391, 1286, 2283, 4037, 5942],
 [64, 391, 1286, 2283, 4037, 2295, 3344],
 [64, 391, 1286, 2283, 4037, 2295, 2581],
 [64, 391, 1286, 2479, 4037, 3344, 2295],
 [64, 391, 1286, 2479, 4037, 5531],
 [64, 391, 1286, 8121, 7107, 7134],
 [64, 391, 1286, 8121, 7107, 8287],
 [64, 391, 1286, 7134, 1746, 3344],
 [64, 391, 1286, 7134, 1746, 5050],
 [64, 391, 1286, 7134, 1746, 7107, 5942],
 [64, 391, 1286, 8287, 4082, 7107],
 [64, 391, 1286, 8287, 7107, 7848],
 [64, 391, 1286, 8287, 2295, 7848],
 [64, 391, 1286, 8287, 2295, 4037, 3344],
 [64, 391, 1286, 8287, 2295, 4037, 6946],
 [64, 391, 7228, 2283, 6946, 4037],
 [64, 8616, 1286, 2283, 7107, 4082],
 [64, 8616, 1286, 2283, 7107, 2683],
 [64, 8616, 1286, 2283, 7107, 2581],
 [64, 8616, 1286, 2283, 7107, 5942],
 [64, 8616, 1286, 2283, 3344, 2295],
 [64, 8616, 1286, 2283, 2295, 2581],
 [64, 8616, 1286, 2479, 158, 3344, 2295],
 [64, 8616, 1286, 2479, 158, 5531],
 [64, 8616, 1286, 7134, 3344, 158],
 [64, 8616, 1286, 7134, 7107, 8121],
 [64, 8616, 1286, 7134, 7107, 2683],
 [64, 8616, 1286, 7134, 7107, 5942],
 [64, 8616, 2997, 7107, 4082, 6685],
 [64, 8616, 2997, 7107, 7134, 8121],
 [64, 8616, 2997, 7107, 7134, 2683],
 [64, 8616, 2997, 7107, 7134, 6685, 5942],
 [64, 7593, 7107, 5960, 6685, 7134],
 [64, 7593, 7107, 2997, 7848, 6691],
 [64, 7593, 7107, 2997, 7848, 8287],
 [64, 7593, 7107, 2997, 7134, 6685, 5942],
 [64, 8084, 1746, 7107, 2997, 1782],
 [64, 2997, 7107, 1746, 7134, 5942],
 [64, 4634, 1286, 6946, 4037, 2295],
 [64, 4634, 1286, 7107, 7134, 8121],
 [64, 4634, 1286, 7107, 7134, 2683],
 [64, 4634, 1286, 7107, 7134, 5942],
 [64, 158, 1286, 7848, 8287, 2295],
 [64, 158, 1286, 8287, 3344, 2295],
 [1098, 6849, 4037, 8190, 1782, 2479],
 [1098, 6849, 4037, 8190, 2295, 6691, 2013],
 [1098, 6849, 4037, 8190, 2295, 2479],
 [1098, 391, 6691, 8190, 7848, 2295],
 [1098, 391, 6691, 8190, 4037, 2256],
 [1098, 391, 6691, 8190, 4037, 2013, 2295],
 [1098, 391, 2283, 4037, 5531, 3805],
 [1098, 391, 2283, 4037, 3805, 2581],
 [1098, 391, 2283, 4037, 5942, 8190],
 [1098, 391, 2283, 4037, 2295, 2581],
 [1098, 391, 2283, 4037, 2295, 8190, 1736],
 [1098, 391, 2283, 4037, 2295, 8190, 3344],
 [1098, 391, 2283, 4037, 2295, 8190, 2013],
 [1098, 391, 2283, 1746, 7107, 7848],
 [1098, 391, 2283, 1746, 7107, 4082],
 [1098, 391, 2283, 1746, 7107, 2581],
 [1098, 391, 2283, 1746, 7107, 5942],
 [1098, 391, 2283, 1746, 3344, 2295],
 [1098, 391, 2283, 1746, 2295, 7848],
 [1098, 391, 2283, 1746, 2295, 2581],
 [1098, 391, 2283, 1746, 2295, 2013],
 [1098, 391, 2283, 8190, 7848, 2295],
 [1098, 391, 2479, 4037, 8190, 1736, 2256],
 [1098, 391, 2479, 4037, 8190, 1736, 2295],
 [1098, 391, 2479, 4037, 8190, 3344, 2256],
 [1098, 391, 2479, 4037, 8190, 3344, 2295],
 [1098, 391, 2479, 4037, 8190, 1782],
 [1098, 391, 2256, 7134, 8190, 1736],
 [1098, 391, 2256, 7134, 8190, 3344],
 [1098, 391, 7134, 1746, 7107, 5942],
 [1736, 1286, 391, 8190, 4037, 2295, 2283],
 [1736, 1286, 391, 8190, 4037, 2295, 8287],
 [1736, 1286, 391, 8190, 4037, 2295, 2479],
 [8190, 391, 1286, 7848, 2295, 2283],
 [8190, 391, 1286, 7848, 2295, 8287],
 [8190, 391, 1286, 4037, 3344, 2295, 2283],
 [8190, 391, 1286, 4037, 3344, 2295, 8287],
 [8190, 391, 1286, 4037, 3344, 2295, 2479],
 [8190, 391, 1286, 4037, 5942, 2283]]
In [ ]:
G_und_filtered = G_und.copy()

for u, v, d in G_und.edges(data=True):
         if G_und[u][v]['Score'] < 4:
           G_und_filtered.remove_edge(u, v)
In [ ]:
print(nx.info(G_und))
print(nx.info(G_und_filtered))
Name: 
Type: Graph
Number of nodes: 135
Number of edges: 1046
Average degree:  15.4963
Name: 
Type: Graph
Number of nodes: 135
Number of edges: 63
Average degree:   0.9333
In [ ]:
new_cliques = list(nx.find_cliques(G_und_filtered))
new_cliques
Out[ ]:
[[2560],
 [1],
 [1538],
 [7189, 2283],
 [8214],
 [4634],
 [6685],
 [6691, 7593],
 [6691, 2683],
 [6691, 2295],
 [2599, 5942],
 [3117],
 [8246],
 [7228, 4037],
 [64, 7107],
 [64, 7848, 158, 8287],
 [64, 7848, 158, 2295],
 [64, 7848, 1286, 8287],
 [64, 3344, 158, 2295],
 [64, 2581],
 [64, 1782],
 [3648],
 [4162, 898],
 [6212],
 [1098, 6944],
 [1098, 3344],
 [1098, 4037, 1736],
 [1098, 5598],
 [76],
 [1100],
 [1105],
 [7761],
 [4694, 6586],
 [6235],
 [4719],
 [3184],
 [6770],
 [7286],
 [2683, 7107],
 [1148],
 [2173],
 [2684],
 [2689],
 [5254, 6899],
 [1158],
 [2699],
 [652],
 [8341],
 [1178],
 [4286],
 [6849],
 [7362],
 [3271],
 [1736, 158, 2295],
 [7375],
 [2256, 8084],
 [1746, 7504],
 [5333],
 [3805],
 [8415, 8121],
 [6880],
 [2283, 7848, 2295],
 [2283, 3971],
 [2283, 5942],
 [4331],
 [3824],
 [753],
 [7412],
 [7948],
 [5914],
 [4381, 3488],
 [6944, 943],
 [6946, 1286],
 [7986],
 [5942, 7134],
 [5942, 1286, 391],
 [4920],
 [2362],
 [6458],
 [1852, 4931],
 [7482],
 [4419],
 [5960],
 [7504, 3013],
 [6993],
 [856],
 [870],
 [7528],
 [2409],
 [3944],
 [3443, 1286, 391],
 [4481, 3013],
 [8580],
 [391, 5050],
 [391, 1286, 7848],
 [391, 1286, 4037],
 [7559],
 [5002],
 [3980, 3488],
 [2957],
 [3983],
 [6040],
 [5531],
 [8605],
 [6049, 7107],
 [2979],
 [6054],
 [8616],
 [1964, 7134],
 [2479],
 [2997],
 [956],
 [7106],
 [3523],
 [8133],
 [1481],
 [8152],
 [2013],
 [2015],
 [6110],
 [5602],
 [8158],
 [6119],
 [4073],
 [4082, 1286],
 [501],
 [8190]]
In [ ]:
new_cliques_gt3 = [x for x in new_cliques if len(x)>2]
new_cliques_gt3
Out[ ]:
[[64, 7848, 158, 8287],
 [64, 7848, 158, 2295],
 [64, 7848, 1286, 8287],
 [64, 3344, 158, 2295],
 [1098, 4037, 1736],
 [1736, 158, 2295],
 [2283, 7848, 2295],
 [5942, 1286, 391],
 [3443, 1286, 391],
 [391, 1286, 7848],
 [391, 1286, 4037]]
In [ ]:
import collections
import matplotlib.pyplot as plt

degree_sequence = sorted([d for n, d in G_und.degree()], reverse=True)  # degree sequence
degreeCount = collections.Counter(degree_sequence)
deg, cnt = zip(*degreeCount.items())

fig, ax = plt.subplots()
plt.bar(deg, cnt, width=0.80, color="b")

plt.title("Degree Histogram")
plt.ylabel("Count")
plt.xlabel("Degree")
ax.set_xticks([d + 0.4 for d in deg])
ax.set_xticklabels(deg)

plt.show()
In [ ]:
import matplotlib.pyplot as plt
import networkx as nx

degrees = [G_und.degree(n) for n in G_und.nodes()]
plt.hist(degrees, bins=8)
plt.show()
In [ ]:
strengths = [G_und.degree(n, weight='Score') for n in G_und.nodes()]
plt.hist(strengths, bins = 8)
plt.show()
In [ ]:
nx.diameter(G_und)
Out[ ]:
5
In [ ]:
print("avarage clustering: ", nx.average_clustering(G_und))
print(nx.transitivity(G_und))
print(nx.average_shortest_path_length(G_und))
avarage clustering:  0.2615021157390727
0.279414358793438
2.2235489220563847
In [ ]:
from networkx.algorithms import community as nxcomm
kl_res = nxcomm.kernighan_lin_bisection(G_und, weight = 'Score')
nxcomm.quality.modularity(G_und, communities = kl_res)
Out[ ]:
0.06765233302501747
In [ ]:
pos = nx.spring_layout(G_und) #calculate position for each node
# pos is needed because we are going to draw a few nodes at a time,
# pos fixes their positions.

# Notice that the pos dict is passed to each call to draw below

# Draw the graph, but don't color the nodes
nx.draw(G_und, pos, edge_color='k',  with_labels=True,
         font_weight='light', node_size= 280, width= 0.9)

#For each community list, draw the nodes, giving it a specific color.
nx.draw_networkx_nodes(G_und, pos, nodelist=kl_res[0], node_color='b')
nx.draw_networkx_nodes(G_und, pos, nodelist=kl_res[1], node_color='r')
Out[ ]:
<matplotlib.collections.PathCollection at 0x7fb65688a750>

CAN ONE SIDE DOMINATE OTHER SIDE COMPLETELY??

In [ ]:
train.drop(columns ={'Unnamed: 0'},inplace = True)
train_source = train[['White Player #','Score']]
train_source['Score'] = np.where(train_source.Score == 1, 'white_win', np.where(train_source.Score == 0, 'white_lost', 'white_draw'))
train_source.rename(columns = {'White Player #':'Player'},inplace = True)
train_target = train[['Black Player #','Score']]
train_target['Score'] = np.where(train_target.Score == 0, 'black_win', np.where(train_target.Score == 1, 'black_lost', 'black_draw'))
train_target.rename(columns = {'Black Player #':'Player'},inplace = True)
train_df = pd.concat([train_source,train_target],0)
train_df.head()
player_stats = pd.DataFrame(train_df.groupby(['Player','Score'])['Score'].describe()).reset_index()
player_stats = pd.DataFrame(player_stats.pivot(index = 'Player',columns = 'Score', values = 'count').fillna(0)).reset_index()
player_stats['total_score'] = (player_stats.black_draw+player_stats.white_draw)*0.5 +(player_stats.black_win+player_stats.white_win)
player_stats['total_game_count'] = player_stats[['black_draw','black_lost','black_win','white_draw','white_lost','white_win']].sum(axis=1)
player_stats['Avg_Score'] = player_stats.total_score / player_stats.total_game_count
player_stats.head()
Out[ ]:
Score Player black_draw black_lost black_win white_draw white_lost white_win total_score total_game_count Avg_Score
0 1 9 9 6 9 3 16 31.0 52 0.596154
1 2 1 0 0 0 0 0 0.5 1 0.500000
2 3 4 1 0 2 1 0 3.0 8 0.375000
3 4 12 6 6 15 3 4 23.5 46 0.510870
4 5 1 1 2 1 4 1 4.0 10 0.400000
In [ ]:
train_white = train[train.Score !=0]
train_black = train[train.Score !=1]
train_black['Score'] = np.where(train_black.Score == 0,1,train_black.Score)
train_white = pd.DataFrame(train_white.groupby(['White Player #','Black Player #'])['Score'].sum()).reset_index()
train_black = pd.DataFrame(train_black.groupby(['White Player #','Black Player #'])['Score'].sum()).reset_index()
train_white.rename(columns = {'White Player #':'Source','Black Player #':'Target'},inplace = True)
train_black.rename(columns = {'White Player #':'Target','Black Player #':'Source'},inplace = True)
train_weighted = pd.concat([train_white,train_black])
train_weighted.rename(columns = {'Score': 'Weight'},inplace = True)
train_weighted = train_weighted.groupby(['Source','Target'])['Weight'].sum().reset_index()
train_weighted.head()
Out[ ]:
Source Target Weight
0 1 235 1.0
1 1 488 0.5
2 1 1377 1.0
3 1 1383 1.0
4 1 1707 0.5
In [ ]:
data_weighted = nx.from_pandas_edgelist(train_weighted, source='Source', target='Target', edge_attr=True, create_using = nx.Graph())
In [ ]:
nx.reciprocity(data_weighted)
Out[ ]:
0.6364741477119239

Between players not may sweeps %64 percent got et least draw from their oponents in games between them so it is exteremely hard to predict correct result!!!

In [ ]:
dgc = nx.degree_centrality(data_weighted)
eig = nx.eigenvector_centrality(data_weighted)
pgr = nx.pagerank(data_weighted)
cls = nx.closeness_centrality(data_weighted)
btw = nx.betweenness_centrality(data_weighted)
In [ ]:
player_stats['dgc'] = player_stats.Player.map(dgc)
player_stats['eig'] = player_stats.Player.map(eig)
player_stats['pgr'] = player_stats.Player.map(pgr)
player_stats['cls'] = player_stats.Player.map(cls)
player_stats['btw'] = player_stats.Player.map(btw)
In [ ]:
# Correlation table
sns.set(font_scale = 1.25)
correlation_matrix = player_stats.corr()
plt.figure(figsize=(13,13))
ax = sns.heatmap(correlation_matrix, vmax=1, cbar=True, square=True, annot=True, fmt='.2f', 
                 annot_kws={'size': 12}, cmap='coolwarm')
ax.xaxis.set_ticks_position('top')
plt.yticks(rotation=0)
plt.xticks(rotation=90)
plt.show()
In [ ]:
player_stats.describe()
Out[ ]:
Score Player black_draw black_lost black_win white_draw white_lost white_win total_score total_game_count Avg_Score dgc eig pgr cls btw
count 7274.000000 7274.000000 7274.000000 7274.000000 7274.000000 7274.00000 7274.000000 7274.000000 7274.000000 7274.000000 7274.000000 7.274000e+03 7274.000000 7274.000000 7274.000000
mean 4313.559527 3.559115 2.631427 1.886170 3.559115 1.88617 2.631427 8.076712 16.153423 0.423910 0.002799 4.347169e-03 0.000137 0.185613 0.000379
std 2491.231319 7.169963 3.594243 3.754529 6.672878 2.54663 5.453412 15.386372 26.788221 0.219512 0.004326 1.089010e-02 0.000110 0.053644 0.000828
min 1.000000 0.000000 0.000000 0.000000 0.000000 0.00000 0.000000 0.000000 1.000000 0.000000 0.000137 2.157101e-24 0.000025 0.000000 0.000000
25% 2147.250000 0.000000 0.000000 0.000000 0.000000 0.00000 0.000000 1.000000 3.000000 0.300000 0.000412 8.221868e-05 0.000057 0.174111 0.000001
50% 4319.500000 1.000000 1.000000 1.000000 1.000000 1.00000 1.000000 2.500000 6.000000 0.464286 0.001100 7.180758e-04 0.000103 0.196102 0.000076
75% 6463.750000 3.000000 3.000000 2.000000 4.000000 3.00000 3.000000 8.000000 17.000000 0.538462 0.003162 3.153403e-03 0.000183 0.214373 0.000364
max 8631.000000 91.000000 33.000000 47.000000 73.000000 26.00000 67.000000 167.500000 280.000000 1.000000 0.040011 1.178396e-01 0.000847 0.271316 0.008961

WEIGHTED NETWORK BETWEEN EXPREINCED PLAYERS

In [ ]:
more_than_hundred_game = player_stats[player_stats.total_game_count > 100]['Player'].unique()
sub_ = train_weighted[train_weighted['Source'].isin(more_than_hundred_game)]
sub_ = sub_[sub_['Target'].isin(more_than_hundred_game)]
sub_.head()
Out[ ]:
Source Target Weight
320 64 158 3.0
324 64 386 2.5
325 64 391 1.0
334 64 1187 0.5
336 64 1286 2.5
In [ ]:
sub_.Weight.sum()
Out[ ]:
5483.0
In [ ]:
data_experienced= nx.from_pandas_edgelist(sub_, source='Source', target='Target', edge_attr=True, create_using = nx.DiGraph())
In [ ]:
nx.reciprocity(data_experienced)
Out[ ]:
0.7968413496051687

Between exprienced players not may sweeps %80 percent got et least draw from their oponents in games between them

In [ ]:
more_than_fifthy_game = player_stats[player_stats.total_game_count > 50]
more_than_fifthy_game_best = more_than_fifthy_game[more_than_fifthy_game.Avg_Score > 0.590833]['Player'].unique()

sub_ = train_weighted[train_weighted['Source'].isin(more_than_fifthy_game_best)]
sub_ = sub_[sub_['Target'].isin(more_than_fifthy_game_best)]
data_best= nx.from_pandas_edgelist(sub_, source='Source', target='Target', edge_attr=True, create_using = nx.DiGraph())
nx.reciprocity(data_best)
Out[ ]:
0.805254140491148

Between best players not may sweeps also %80 percent got et least draw from their oponents in games between them

Node2Vec Embedings

In [ ]:
edge_list = nx.from_pandas_edgelist(train,  source='White Player #', target='Black Player #',create_using = nx.Graph())
n2v = Node2Vec(edge_list, dimensions=20, walk_length=50, num_walks=500, p = 1, q = 1) 
model = n2v.fit(window=10)
model.wv.save_word2vec_format('/content/drive/MyDrive/DA 516 - Network Project/train_embs.txt')
Generating walks (CPU: 1):   0%|          | 0/500 [00:00<?, ?it/s]

Generating walks (CPU: 1): 100%|██████████| 500/500 [2:28:38<00:00, 17.84s/it]
In [ ]:
embs = pd.read_csv('/content/drive/MyDrive/DA 516 - Network Project/train_embs.txt', sep=' ', skiprows=1, header=None, index_col = 0)
embs.head()
Out[ ]:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
0
1512 -0.140117 -0.146476 0.536665 -0.506911 -0.211689 -0.194787 -0.195652 0.052138 0.422277 0.087211 -0.034479 -0.101355 0.094268 -0.193407 0.480607 -0.017301 -0.002120 -0.456672 0.034241 0.213050
4037 0.296052 -0.309343 0.257407 -0.479696 -0.073326 -0.156649 -0.203972 -0.138164 0.414848 0.111370 -0.072726 -0.210621 -0.204549 -0.489221 0.423295 -0.056546 0.060172 -0.577684 -0.218978 0.141700
4850 0.194777 -0.420180 0.002878 -0.603672 -0.013753 0.070750 0.159811 -0.119848 0.484111 0.027858 -0.010380 -0.145485 -0.242185 -0.342177 0.446030 0.112637 0.337551 -0.514353 -0.356066 0.349810
1098 0.157644 -0.442755 0.303189 -0.436315 0.027939 0.097452 -0.109111 0.103205 0.566408 0.265448 -0.049799 -0.140494 0.082030 -0.302849 0.502854 -0.079620 -0.080255 -0.495551 0.149452 0.040660
5187 -0.608000 -0.551735 0.569259 -0.201383 -0.176622 0.052497 0.110422 0.263841 0.182262 0.149080 0.026172 0.381776 0.271841 -0.114943 0.201463 -0.046823 -0.149873 -0.690599 0.012418 0.170924
In [ ]:
player_stats['total_score_bin'] = pd.qcut(player_stats['total_score'], 3, labels=["low", "medium", "high"])
player_stats.groupby('total_score_bin')['total_score'].describe()
Out[ ]:
count mean std min 25% 50% 75% max
total_score_bin
low 2880.0 0.708333 0.529439 0.0 0.5 0.5 1.0 1.5
medium 2108.0 3.279886 1.135330 2.0 2.5 3.0 4.0 5.5
high 2286.0 21.783027 21.780358 6.0 8.5 13.5 25.5 167.5
In [ ]:
pipe_tsne = Pipeline([
          ("scaler", StandardScaler()),
          ("tsne", TSNE(n_components=2))
])
embeded_tsne = pipe_tsne.fit_transform(embs)
In [ ]:
plt.rcParams['figure.figsize'] = [10, 10]
sns.scatterplot(x=embeded_tsne[:, 0], y=embeded_tsne[:,1], hue = player_stats['total_score_bin']);

Cosine Similarities

In [ ]:
candidate_nodes = list(embs.index)
all_pairs = combinations(candidate_nodes, 2)

similarity = []
pair0 = []
pair1 = []
for p in all_pairs:
  pair0.append(p[0])
  pair1.append(p[1])
  similarity.append(model.wv.similarity(str(p[0]), str(p[1])))

d = {'similarity':similarity, 'player_1': pair0, 'player_2': pair1 }
similarity_df = pd.DataFrame(d)
similarity_df.to_csv('/content/drive/MyDrive/DA 516 - Network Project/train_similarity.csv',index = False)
In [ ]:
similarity = pd.read_csv('/content/drive/MyDrive/DA 516 - Network Project/train_similarity.csv')
similarity.head()
Out[ ]:
similarity player_1 player_2
0 0.798034 1512 4037
1 0.646268 1512 4850
2 0.832137 1512 1098
3 0.670043 1512 5187
4 0.778562 1512 1286
In [ ]:
train_df_1 = train.merge(similarity,how = 'left', left_on = ['White Player #','Black Player #'], right_on =['player_1','player_2'])
train_df_1.dropna(inplace = True)
train_df_2 = train.merge(similarity,how = 'left', left_on = ['White Player #','Black Player #'], right_on =['player_2','player_1'])
train_df_2.dropna(inplace = True)
train_df = pd.concat([train_df_1,train_df_2],0)
train_df.drop(columns = ['player_1','player_2'],inplace = True)
del train_df_1,train_df_2
train_df['Score_names'] = np.where(train_df.Score == 1, 'white_wins', np.where(train_df.Score==0,'black_wins','draw'))
train_df.head()
Out[ ]:
Month # White Player # Black Player # Score similarity Score_names
2 1 73 5104 0.5 0.834861 draw
3 1 73 7321 1.0 0.667161 white_wins
7 1 88 4858 1.0 0.946291 white_wins
10 1 189 7357 1.0 0.938667 white_wins
11 1 213 7591 0.0 0.199912 black_wins
In [ ]:
sns.boxplot(x='similarity',y='Score_names',data = train_df,showmeans=True);
del train_df

Combining All Features into a single DataFrame

In [ ]:
## player statistics calculated on train data
train_df = train.merge(player_stats,how = 'left', left_on = 'White Player #',right_on = 'Player').drop(columns = 'Player')
train_df = train_df.rename(columns = {'black_draw':'White_Player_black_draw','black_lost':'White_Player_black_lost', 
                           'black_win':'White_Player_black_win', 'white_draw':'White_Player_white_draw', 
                           'white_lost': 'White_Player_white_lost','white_win': 'White_Player_white_win', 'total_score': 'White_Player_total_score', 
                           'total_game_count': 'White_Player_total_game_count', 'Avg_Score': 'White_Player_Avg_Score'})

train_df = train_df.merge(player_stats,how = 'left', left_on = 'Black Player #',right_on = 'Player').drop(columns = 'Player')
train_df = train_df.rename(columns = {'black_draw':'Black_Player_black_draw','black_lost':'Black_Player_black_lost', 
                           'black_win':'Black_Player_black_win', 'white_draw':'Black_Player_white_draw', 
                           'white_lost': 'Black_Player_white_lost','white_win': 'Black_Player_white_win', 'total_score': 'Black_Player_total_score', 
                           'total_game_count': 'Black_Player_total_game_count', 'Avg_Score': 'Black_Player_Avg_Score'})

test_df = test.merge(player_stats,how = 'left', left_on = 'White Player #',right_on = 'Player').drop(columns = 'Player')
test_df = test_df.rename(columns = {'black_draw':'White_Player_black_draw','black_lost':'White_Player_black_lost', 
                           'black_win':'White_Player_black_win', 'white_draw':'White_Player_white_draw', 
                           'white_lost': 'White_Player_white_lost','white_win': 'White_Player_white_win', 'total_score': 'White_Player_total_score', 
                           'total_game_count': 'White_Player_total_game_count', 'Avg_Score': 'White_Player_Avg_Score'})

test_df = test_df.merge(player_stats,how = 'left', left_on = 'Black Player #',right_on = 'Player').drop(columns = 'Player')
test_df = test_df.rename(columns = {'black_draw':'Black_Player_black_draw','black_lost':'Black_Player_black_lost', 
                           'black_win':'Black_Player_black_win', 'white_draw':'Black_Player_white_draw', 
                           'white_lost': 'Black_Player_white_lost','white_win': 'Black_Player_white_win', 'total_score': 'Black_Player_total_score', 
                           'total_game_count': 'Black_Player_total_game_count', 'Avg_Score': 'Black_Player_Avg_Score'})

print(test_df.shape)
print(train_df.shape)
train_df.head()
(6239, 22)
(58750, 22)
Out[ ]:
Month # White Player # Black Player # Score White_Player_black_draw White_Player_black_lost White_Player_black_win White_Player_white_draw White_Player_white_lost white_win_x White_Player_total_score White_Player_total_game_count White_Player_Avg_Score Black_Player_black_draw Black_Player_black_lost Black_Player_black_win Black_Player_white_draw Black_Player_white_win white_win_y Black_Player_total_score Black_Player_total_game_count Black_Player_Avg_Score
0 1 73 1246 0.5 15 4 3 21 1 4 25.0 48 0.520833 19 13 16 17 5 11 45.0 81 0.555556
1 1 73 5097 0.5 15 4 3 21 1 4 25.0 48 0.520833 29 5 4 32 5 10 44.5 85 0.523529
2 1 73 5104 0.5 15 4 3 21 1 4 25.0 48 0.520833 4 1 1 3 0 3 7.5 12 0.625000
3 1 73 7321 1.0 15 4 3 21 1 4 25.0 48 0.520833 0 7 1 4 5 1 4.0 18 0.222222
4 1 73 7375 0.5 15 4 3 21 1 4 25.0 48 0.520833 25 8 15 23 6 18 57.0 95 0.600000
In [ ]:
## player centralities calculated on train data
train_df = train_df.merge(cr, how ='left', left_on = 'White Player #',right_on = 'Player')
train_df = train_df.rename(columns  = {'dgc':'White_dgc', 'eig':'White_eig', 'pgr':'White_pgr','cls':'White_cls','btw':'White_btw'})
train_df.drop(columns = 'Player',inplace = True)
train_df = train_df.merge(cr, how ='left', left_on = 'Black Player #',right_on = 'Player')
train_df = train_df.rename(columns  = {'dgc':'Black_dgc', 'eig':'Black_eig', 'pgr':'Black_pgr','cls':'Black_cls','btw':'Black_btw'})
train_df.drop(columns = 'Player',inplace = True)

test_df = test_df.merge(cr, how ='left', left_on = 'White Player #',right_on = 'Player')
test_df = test_df.rename(columns  = {'dgc':'White_dgc', 'eig':'White_eig', 'pgr':'White_pgr','cls':'White_cls','btw':'White_btw'})
test_df.drop(columns = 'Player',inplace = True)
test_df = test_df.merge(cr, how ='left', left_on = 'Black Player #',right_on = 'Player')
test_df = test_df.rename(columns  = {'dgc':'Black_dgc', 'eig':'Black_eig', 'pgr':'Black_pgr','cls':'Black_cls','btw':'Black_btw'})
test_df.drop(columns = 'Player',inplace = True)

print(test_df.shape)
print(train_df.shape)
train_df.head()
(6239, 32)
(58750, 32)
Out[ ]:
Month # White Player # Black Player # Score White_Player_black_draw White_Player_black_lost White_Player_black_win White_Player_white_draw White_Player_white_lost white_win_x White_Player_total_score White_Player_total_game_count White_Player_Avg_Score Black_Player_black_draw Black_Player_black_lost Black_Player_black_win Black_Player_white_draw Black_Player_white_win white_win_y Black_Player_total_score Black_Player_total_game_count Black_Player_Avg_Score White_dgc White_eig White_pgr White_cls White_btw Black_dgc Black_eig Black_pgr Black_cls Black_btw
0 1 73 1246 0.5 15 4 3 21 1 4 25.0 48 0.520833 19 13 16 17 5 11 45.0 81 0.555556 0.005775 0.007068 0.00031 0.290054 0.000721 0.008662 0.044762 0.000401 0.315980 0.001156
1 1 73 5097 0.5 15 4 3 21 1 4 25.0 48 0.520833 29 5 4 32 5 10 44.5 85 0.523529 0.005775 0.007068 0.00031 0.290054 0.000721 0.008387 0.017293 0.000412 0.307067 0.001005
2 1 73 5104 0.5 15 4 3 21 1 4 25.0 48 0.520833 4 1 1 3 0 3 7.5 12 0.625000 0.005775 0.007068 0.00031 0.290054 0.000721 0.001650 0.005471 0.000103 0.274586 0.000165
3 1 73 7321 1.0 15 4 3 21 1 4 25.0 48 0.520833 0 7 1 4 5 1 4.0 18 0.222222 0.005775 0.007068 0.00031 0.290054 0.000721 0.002337 0.003249 0.000154 0.269300 0.000353
4 1 73 7375 0.5 15 4 3 21 1 4 25.0 48 0.520833 25 8 15 23 6 18 57.0 95 0.600000 0.005775 0.007068 0.00031 0.290054 0.000721 0.010450 0.021062 0.000582 0.306751 0.003531
In [ ]:
## player embedings calculated on train data
train_df = train_df.merge(embs, how ='left', left_on = 'White Player #',right_on = embs.index )
train_df = train_df.merge(embs, how ='left', left_on = 'Black Player #',right_on = embs.index )

test_df = test_df.merge(embs, how ='left', left_on = 'White Player #',right_on = embs.index )
test_df = test_df.merge(embs, how ='left', left_on = 'Black Player #',right_on = embs.index )

print(test_df.shape)
print(train_df.shape)
train_df.head()
(6239, 72)
(58750, 72)
Out[ ]:
Month # White Player # Black Player # Score White_Player_black_draw White_Player_black_lost White_Player_black_win White_Player_white_draw White_Player_white_lost white_win_x White_Player_total_score White_Player_total_game_count White_Player_Avg_Score Black_Player_black_draw Black_Player_black_lost Black_Player_black_win Black_Player_white_draw Black_Player_white_win white_win_y Black_Player_total_score Black_Player_total_game_count Black_Player_Avg_Score White_dgc White_eig White_pgr White_cls White_btw Black_dgc Black_eig Black_pgr Black_cls Black_btw 1_x 2_x 3_x 4_x 5_x 6_x 7_x 8_x 9_x 10_x 11_x 12_x 13_x 14_x 15_x 16_x 17_x 18_x 19_x 20_x 1_y 2_y 3_y 4_y 5_y 6_y 7_y 8_y 9_y 10_y 11_y 12_y 13_y 14_y 15_y 16_y 17_y 18_y 19_y 20_y
0 1 73 1246 0.5 15 4 3 21 1 4 25.0 48 0.520833 19 13 16 17 5 11 45.0 81 0.555556 0.005775 0.007068 0.00031 0.290054 0.000721 0.008662 0.044762 0.000401 0.315980 0.001156 0.163132 0.16836 0.326011 -0.883279 0.206807 0.066884 0.110625 -0.098681 0.981163 0.374971 -0.353892 0.922056 0.449311 0.188661 0.551793 -0.631297 -0.452001 0.038696 0.080717 -0.667021 0.490058 -0.127381 0.301327 -0.516885 0.036232 0.285136 -0.319521 -0.072778 0.644876 0.194620 -0.010995 -0.079631 0.499541 -0.314857 0.391931 -0.367863 0.017059 -0.611595 0.051676 -0.048731
1 1 73 5097 0.5 15 4 3 21 1 4 25.0 48 0.520833 29 5 4 32 5 10 44.5 85 0.523529 0.005775 0.007068 0.00031 0.290054 0.000721 0.008387 0.017293 0.000412 0.307067 0.001005 0.163132 0.16836 0.326011 -0.883279 0.206807 0.066884 0.110625 -0.098681 0.981163 0.374971 -0.353892 0.922056 0.449311 0.188661 0.551793 -0.631297 -0.452001 0.038696 0.080717 -0.667021 0.289428 0.232610 0.346035 -0.858141 0.122297 0.054381 0.034456 0.075318 0.796044 -0.008088 -0.305571 0.568713 0.538660 0.189825 0.453790 -0.645213 -0.246761 -0.108593 -0.094279 -0.432937
2 1 73 5104 0.5 15 4 3 21 1 4 25.0 48 0.520833 4 1 1 3 0 3 7.5 12 0.625000 0.005775 0.007068 0.00031 0.290054 0.000721 0.001650 0.005471 0.000103 0.274586 0.000165 0.163132 0.16836 0.326011 -0.883279 0.206807 0.066884 0.110625 -0.098681 0.981163 0.374971 -0.353892 0.922056 0.449311 0.188661 0.551793 -0.631297 -0.452001 0.038696 0.080717 -0.667021 0.467215 0.073953 0.332907 -0.538506 0.123368 0.087190 -0.201920 -0.610260 0.967716 0.467387 -0.097479 0.824193 0.560178 -0.109209 0.473373 -0.707418 -0.884763 -0.373118 -0.485153 -0.246257
3 1 73 7321 1.0 15 4 3 21 1 4 25.0 48 0.520833 0 7 1 4 5 1 4.0 18 0.222222 0.005775 0.007068 0.00031 0.290054 0.000721 0.002337 0.003249 0.000154 0.269300 0.000353 0.163132 0.16836 0.326011 -0.883279 0.206807 0.066884 0.110625 -0.098681 0.981163 0.374971 -0.353892 0.922056 0.449311 0.188661 0.551793 -0.631297 -0.452001 0.038696 0.080717 -0.667021 0.668926 -0.074553 0.332954 -0.487163 -0.095281 -0.451523 -0.252841 -0.404024 1.239548 0.076273 -0.135391 1.169203 1.015446 0.028827 0.224751 0.084512 -0.727531 -0.368563 -0.658022 0.168307
4 1 73 7375 0.5 15 4 3 21 1 4 25.0 48 0.520833 25 8 15 23 6 18 57.0 95 0.600000 0.005775 0.007068 0.00031 0.290054 0.000721 0.010450 0.021062 0.000582 0.306751 0.003531 0.163132 0.16836 0.326011 -0.883279 0.206807 0.066884 0.110625 -0.098681 0.981163 0.374971 -0.353892 0.922056 0.449311 0.188661 0.551793 -0.631297 -0.452001 0.038696 0.080717 -0.667021 0.144039 0.134054 0.486926 -0.640323 0.100262 0.355364 -0.481281 0.217149 0.862279 0.039721 0.159716 0.422534 0.792576 -0.403788 -0.046371 -0.950829 -0.126885 -0.475375 -0.382077 -0.275519
In [ ]:
## player similarities calculated on train data

train_df_1 = train_df.merge(similarity,how = 'left', left_on = ['White Player #','Black Player #'], right_on =['player_1','player_2'])
train_df_1.dropna(inplace = True)
train_df_2 = train_df.merge(similarity,how = 'left', left_on = ['White Player #','Black Player #'], right_on =['player_2','player_1'])
train_df_2.dropna(inplace = True)
train_df = pd.concat([train_df_1,train_df_2],0)
train_df.drop(columns = ['player_1','player_2'],inplace = True)
del train_df_1,train_df_2

test_df_1 = test_df.merge(similarity,how = 'left', left_on = ['White Player #','Black Player #'], right_on =['player_1','player_2'])
test_df_1.dropna(inplace = True)
test_df_2 = test_df.merge(similarity,how = 'left', left_on = ['White Player #','Black Player #'], right_on =['player_2','player_1'])
test_df_2.dropna(inplace = True)
test_df = pd.concat([test_df_1,test_df_2],0)
test_df.drop(columns = ['player_1','player_2'],inplace = True)
del test_df_1,test_df_2

print(test_df.shape)
print(train_df.shape)
train_df.head()
(6239, 73)
(58750, 73)
Out[ ]:
Month # White Player # Black Player # Score White_Player_black_draw White_Player_black_lost White_Player_black_win White_Player_white_draw White_Player_white_lost white_win_x White_Player_total_score White_Player_total_game_count White_Player_Avg_Score Black_Player_black_draw Black_Player_black_lost Black_Player_black_win Black_Player_white_draw Black_Player_white_win white_win_y Black_Player_total_score Black_Player_total_game_count Black_Player_Avg_Score White_dgc White_eig White_pgr White_cls White_btw Black_dgc Black_eig Black_pgr Black_cls Black_btw 1_x 2_x 3_x 4_x 5_x 6_x 7_x 8_x 9_x 10_x 11_x 12_x 13_x 14_x 15_x 16_x 17_x 18_x 19_x 20_x 1_y 2_y 3_y 4_y 5_y 6_y 7_y 8_y 9_y 10_y 11_y 12_y 13_y 14_y 15_y 16_y 17_y 18_y 19_y 20_y similarity
2 1 73 5104 0.5 15 4 3 21 1 4 25.0 48 0.520833 4 1 1 3 0 3 7.5 12 0.625000 0.005775 0.007068 0.000310 0.290054 0.000721 0.001650 0.005471 0.000103 0.274586 0.000165 0.163132 0.168360 0.326011 -0.883279 0.206807 0.066884 0.110625 -0.098681 0.981163 0.374971 -0.353892 0.922056 0.449311 0.188661 0.551793 -0.631297 -0.452001 0.038696 0.080717 -0.667021 0.467215 0.073953 0.332907 -0.538506 0.123368 0.087190 -0.201920 -0.610260 0.967716 0.467387 -0.097479 0.824193 0.560178 -0.109209 0.473373 -0.707418 -0.884763 -0.373118 -0.485153 -0.246257 0.834861
3 1 73 7321 1.0 15 4 3 21 1 4 25.0 48 0.520833 0 7 1 4 5 1 4.0 18 0.222222 0.005775 0.007068 0.000310 0.290054 0.000721 0.002337 0.003249 0.000154 0.269300 0.000353 0.163132 0.168360 0.326011 -0.883279 0.206807 0.066884 0.110625 -0.098681 0.981163 0.374971 -0.353892 0.922056 0.449311 0.188661 0.551793 -0.631297 -0.452001 0.038696 0.080717 -0.667021 0.668926 -0.074553 0.332954 -0.487163 -0.095281 -0.451523 -0.252841 -0.404024 1.239548 0.076273 -0.135391 1.169203 1.015446 0.028827 0.224751 0.084512 -0.727531 -0.368563 -0.658022 0.168307 0.667161
7 1 88 4858 1.0 1 3 0 1 0 2 3.0 7 0.428571 2 1 0 0 1 0 1.0 4 0.250000 0.000962 0.001542 0.000076 0.256863 0.000022 0.000550 0.001644 0.000048 0.255269 0.000004 0.538226 0.493744 0.709397 -0.754815 0.179737 1.033267 0.190188 -0.556905 0.570076 -0.271226 0.276955 -0.179871 0.505373 -0.250041 0.185983 -0.641963 0.572927 -0.814884 -0.740935 0.029005 0.559483 0.269101 0.513781 -0.708710 -0.058017 0.935143 0.065209 -0.317726 0.583640 -0.509378 0.140417 -0.162932 0.569514 -0.253210 0.550684 -0.579341 0.926679 -0.644847 -0.667662 0.132325 0.946291
10 1 189 7357 1.0 5 2 1 4 6 5 10.5 23 0.456522 0 1 2 0 0 0 2.0 3 0.666667 0.003162 0.003387 0.000254 0.275081 0.001210 0.000412 0.000093 0.000050 0.218883 0.000003 -0.951565 0.410626 1.159523 -0.546987 -0.225026 -0.761373 0.246602 0.651163 0.818939 -0.394692 -0.207342 -0.297563 0.186359 0.150464 0.342881 0.161321 0.482919 -0.332626 -0.301247 0.548186 -0.775404 0.433799 1.654494 -0.551920 -0.325113 -0.704920 0.359072 1.020616 0.751303 -0.764182 -0.527987 -0.434379 0.391705 0.271417 0.276120 0.272103 0.193125 -0.810502 -0.087846 0.969169 0.938667
11 1 213 7591 0.0 29 15 14 22 16 19 58.5 115 0.508696 4 11 4 7 9 10 19.5 45 0.433333 0.013337 0.049811 0.000662 0.327116 0.004479 0.005637 0.007742 0.000339 0.294015 0.001279 -0.274130 0.109963 0.415997 -0.221602 -0.064719 -0.217243 0.378942 -0.042216 0.488780 0.047371 0.362149 -0.068953 0.122025 -0.169611 0.582235 0.110289 0.229217 -0.843138 0.193006 -0.203671 0.086619 0.001439 1.229043 -0.910858 -0.049992 -0.438422 -0.218143 -0.155601 -0.153549 -0.096700 -0.493873 -0.014393 0.518392 0.209441 0.064390 0.097913 -0.433577 -0.085006 0.233059 0.027717 0.199912
In [ ]:
train_df.to_csv('/content/drive/MyDrive/DA 516 - Network Project/train_df.csv',index = False)
test_df.to_csv('/content/drive/MyDrive/DA 516 - Network Project/test_df.csv',index = False)
In [ ]:
train_df = pd.read_csv('/content/drive/MyDrive/DA 516 - Network Project/train_df.csv')
test_df = pd.read_csv('/content/drive/MyDrive/DA 516 - Network Project/test_df.csv')
print(train_df.shape)
print(test_df.shape)
train_df.head()
(58750, 73)
(6239, 73)
Out[ ]:
Month # White Player # Black Player # Score White_Player_black_draw White_Player_black_lost White_Player_black_win White_Player_white_draw White_Player_white_lost white_win_x White_Player_total_score White_Player_total_game_count White_Player_Avg_Score Black_Player_black_draw Black_Player_black_lost Black_Player_black_win Black_Player_white_draw Black_Player_white_win white_win_y Black_Player_total_score Black_Player_total_game_count Black_Player_Avg_Score White_dgc White_eig White_pgr White_cls White_btw Black_dgc Black_eig Black_pgr Black_cls Black_btw 1_x 2_x 3_x 4_x 5_x 6_x 7_x 8_x 9_x 10_x 11_x 12_x 13_x 14_x 15_x 16_x 17_x 18_x 19_x 20_x 1_y 2_y 3_y 4_y 5_y 6_y 7_y 8_y 9_y 10_y 11_y 12_y 13_y 14_y 15_y 16_y 17_y 18_y 19_y 20_y similarity
0 1 73 5104 0.5 15 4 3 21 1 4 25.0 48 0.520833 4 1 1 3 0 3 7.5 12 0.625000 0.005775 0.007068 0.000310 0.290054 0.000721 0.001650 0.005471 0.000103 0.274586 0.000165 0.163132 0.168360 0.326011 -0.883279 0.206807 0.066884 0.110625 -0.098681 0.981163 0.374971 -0.353892 0.922056 0.449311 0.188661 0.551793 -0.631297 -0.452001 0.038696 0.080717 -0.667021 0.467215 0.073953 0.332907 -0.538506 0.123368 0.087190 -0.201920 -0.610260 0.967716 0.467387 -0.097479 0.824193 0.560178 -0.109209 0.473373 -0.707418 -0.884763 -0.373118 -0.485153 -0.246257 0.834861
1 1 73 7321 1.0 15 4 3 21 1 4 25.0 48 0.520833 0 7 1 4 5 1 4.0 18 0.222222 0.005775 0.007068 0.000310 0.290054 0.000721 0.002337 0.003249 0.000154 0.269300 0.000353 0.163132 0.168360 0.326011 -0.883279 0.206807 0.066884 0.110625 -0.098681 0.981163 0.374971 -0.353892 0.922056 0.449311 0.188661 0.551793 -0.631297 -0.452001 0.038696 0.080717 -0.667021 0.668926 -0.074553 0.332954 -0.487163 -0.095281 -0.451523 -0.252841 -0.404024 1.239548 0.076273 -0.135391 1.169203 1.015446 0.028827 0.224751 0.084512 -0.727531 -0.368563 -0.658022 0.168307 0.667161
2 1 88 4858 1.0 1 3 0 1 0 2 3.0 7 0.428571 2 1 0 0 1 0 1.0 4 0.250000 0.000962 0.001542 0.000076 0.256863 0.000022 0.000550 0.001644 0.000048 0.255269 0.000004 0.538226 0.493744 0.709397 -0.754815 0.179737 1.033267 0.190188 -0.556905 0.570076 -0.271226 0.276955 -0.179871 0.505373 -0.250041 0.185983 -0.641963 0.572927 -0.814884 -0.740935 0.029005 0.559483 0.269101 0.513781 -0.708710 -0.058017 0.935143 0.065209 -0.317727 0.583640 -0.509378 0.140417 -0.162932 0.569514 -0.253210 0.550684 -0.579341 0.926679 -0.644847 -0.667662 0.132325 0.946291
3 1 189 7357 1.0 5 2 1 4 6 5 10.5 23 0.456522 0 1 2 0 0 0 2.0 3 0.666667 0.003162 0.003387 0.000254 0.275081 0.001210 0.000412 0.000093 0.000050 0.218883 0.000003 -0.951565 0.410626 1.159523 -0.546987 -0.225026 -0.761373 0.246602 0.651163 0.818939 -0.394692 -0.207342 -0.297563 0.186359 0.150464 0.342881 0.161321 0.482919 -0.332626 -0.301247 0.548186 -0.775404 0.433799 1.654494 -0.551920 -0.325113 -0.704920 0.359072 1.020616 0.751303 -0.764182 -0.527987 -0.434379 0.391705 0.271417 0.276120 0.272103 0.193125 -0.810502 -0.087846 0.969169 0.938667
4 1 213 7591 0.0 29 15 14 22 16 19 58.5 115 0.508696 4 11 4 7 9 10 19.5 45 0.433333 0.013337 0.049811 0.000662 0.327116 0.004479 0.005637 0.007742 0.000339 0.294015 0.001279 -0.274130 0.109963 0.415997 -0.221602 -0.064719 -0.217243 0.378942 -0.042216 0.488780 0.047371 0.362149 -0.068953 0.122025 -0.169611 0.582235 0.110289 0.229217 -0.843138 0.193006 -0.203671 0.086619 0.001439 1.229043 -0.910858 -0.049992 -0.438422 -0.218143 -0.155601 -0.153549 -0.096700 -0.493873 -0.014393 0.518392 0.209441 0.064390 0.097913 -0.433577 -0.085006 0.233059 0.027717 0.199912

Modelling

In [ ]:
features = train_df.drop(columns = ['White Player #', 'Black Player #', 'Score']).columns.to_list()
train_df['target'] = np.where(train_df.Score == 1,1 , np.where(train_df.Score == 0, 2,3 ))

Logistic Regression

In [ ]:
pipeline = Pipeline(steps=[('preprocessor', StandardScaler()),
                           ('classifier',   LogisticRegression(random_state=42))])

params = [{'classifier__C'      : np.arange(0.1, 5.0, 0.5), 
           'classifier__penalty': ['l1'], 
           'classifier__solver' : ['liblinear','saga']}, 
          
         {'classifier__C'      : np.arange(0.1, 5.0, 0.5), 
         'classifier__penalty': ['l2'], 
         'classifier__solver' : ['liblinear', 'newton-cg', 'lbfgs', 'sag', 'saga']}
         ]

met = ['accuracy', 'f1_weighted', 'precision_weighted', 'recall_weighted']

cv = RepeatedStratifiedKFold(n_splits=4, n_repeats=3,random_state=42)
log_grid = RandomizedSearchCV(pipeline,param_distributions = params,cv = cv,verbose = 1, n_jobs = -1, scoring = met, refit = 'f1_weighted',n_iter =30)
log_grid.fit(train_df[features], train_df.target)
print(log_grid.best_params_)
print(log_grid.best_score_)
Fitting 12 folds for each of 30 candidates, totalling 360 fits
[Parallel(n_jobs=-1)]: Using backend LokyBackend with 4 concurrent workers.
[Parallel(n_jobs=-1)]: Done  42 tasks      | elapsed:  7.1min
[Parallel(n_jobs=-1)]: Done 192 tasks      | elapsed: 21.9min
[Parallel(n_jobs=-1)]: Done 360 out of 360 | elapsed: 46.3min finished
{'classifier__solver': 'lbfgs', 'classifier__penalty': 'l2', 'classifier__C': 3.1}
0.6095393795417858
In [ ]:
print('Logistic Regression Cross Validation Results')
print('')
print('Mean Accuracy Score :',log_grid.cv_results_['mean_test_accuracy'].mean())
print('='*20)
print('Mean f1-weighted Score :' ,log_grid.cv_results_['mean_test_f1_weighted'].mean())
print('='*20)
print('Mean Precision Score Precision :',log_grid.cv_results_['mean_test_precision_weighted'].mean())
print('='*20)
print('Mean Recall Score :',log_grid.cv_results_['mean_test_recall_weighted'].mean())
Logistic Regression Cross Validation Results

Mean Accuracy Score : 0.6125819397657003
====================
Mean f1-weighted Score : 0.6091946121469353
====================
Mean Precision Score Precision : 0.6138400672276948
====================
Mean Recall Score : 0.6125819397657003
In [ ]:
test_df['target'] = np.where(test_df.Score == 1,1 , np.where(test_df.Score == 0, 2,3 ))
y_pred_log = log_grid.predict(test_df[features])
target_names = ['White_Wins', 'Black_Wins', 'Draw']
print(classification_report(test_df['target'], y_pred_log, target_names=target_names))
              precision    recall  f1-score   support

  White_Wins       0.50      0.48      0.49      2007
  Black_Wins       0.45      0.38      0.41      1485
        Draw       0.52      0.58      0.55      2747

    accuracy                           0.50      6239
   macro avg       0.49      0.48      0.49      6239
weighted avg       0.50      0.50      0.50      6239

In [ ]:
confusion_matrix(test_df['target'], y_pred_log)
Out[ ]:
array([[ 964,  231,  812],
       [ 268,  565,  652],
       [ 689,  453, 1605]])

Random Forest

In [ ]:
param_grid = {  
    'clf__n_estimators' : [100,300],
    'clf__criterion' :['gini','entropy'],
    'clf__max_depth' : [3,5,9],
    'clf__max_features' :['auto'],
    'clf__min_samples_leaf' :[30,50,100],
    'clf__min_samples_split' : [30,50,100],
    'clf__class_weight' :['balanced',None],
    'clf__bootstrap': [False]
}                                            


pipeline = Pipeline(steps=[('preprocessor', StandardScaler()),('clf',RandomForestClassifier(random_state=42))])

cv = RepeatedStratifiedKFold(n_splits=4, n_repeats=3,random_state=42)

grid_rdf = RandomizedSearchCV(pipeline,param_distributions = param_grid,cv = cv,verbose = 1, n_jobs = -1, scoring = met, refit = 'f1_weighted',n_iter =30)
grid_rdf.fit(train_df[features], train_df.target)
print(grid_rdf.best_params_)
print(grid_rdf.best_score_)
Fitting 12 folds for each of 30 candidates, totalling 360 fits
[Parallel(n_jobs=-1)]: Using backend LokyBackend with 4 concurrent workers.
[Parallel(n_jobs=-1)]: Done  42 tasks      | elapsed: 10.5min
[Parallel(n_jobs=-1)]: Done 192 tasks      | elapsed: 39.2min
[Parallel(n_jobs=-1)]: Done 360 out of 360 | elapsed: 75.8min finished
{'clf__n_estimators': 300, 'clf__min_samples_split': 50, 'clf__min_samples_leaf': 30, 'clf__max_features': 'auto', 'clf__max_depth': 9, 'clf__criterion': 'gini', 'clf__class_weight': None, 'clf__bootstrap': False}
0.6002636603983637
In [ ]:
print('Random Forest Cross Validation Results')
print('')
print('Mean Accuracy Score :',grid_rdf.cv_results_['mean_test_accuracy'].mean())
print('='*20)
print('Mean f1-weighted Score :' ,grid_rdf.cv_results_['mean_test_f1_weighted'].mean())
print('='*20)
print('Mean Precision Score Precision :',grid_rdf.cv_results_['mean_test_precision_weighted'].mean())
print('='*20)
print('Mean Recall Score :',grid_rdf.cv_results_['mean_test_recall_weighted'].mean())
Random Forest Cross Validation Results

Mean Accuracy Score : 0.5681554569513758
====================
Mean f1-weighted Score : 0.5520538555316228
====================
Mean Precision Score Precision : 0.6032935436944046
====================
Mean Recall Score : 0.5681554569513758
In [ ]:
test_df['target'] = np.where(test_df.Score == 1,1 , np.where(test_df.Score == 0, 2,3 ))
y_pred_rdf = grid_rdf.predict(test_df[features])
target_names = ['White_Wins', 'Black_Wins', 'Draw']
print(classification_report(test_df['target'], y_pred_rdf, target_names=target_names))
              precision    recall  f1-score   support

  White_Wins       0.51      0.37      0.43      2007
  Black_Wins       0.46      0.25      0.33      1485
        Draw       0.50      0.71      0.59      2747

    accuracy                           0.49      6239
   macro avg       0.49      0.45      0.45      6239
weighted avg       0.49      0.49      0.47      6239

In [ ]:
confusion_matrix(test_df['target'], y_pred_rdf)
Out[ ]:
array([[ 745,  160, 1102],
       [ 222,  377,  886],
       [ 506,  279, 1962]])

XGBoost

In [ ]:
param_grid = {  
    'clf__learning_rate' : [0.1],
    'clf__n_estimators' : [300],
    'clf__max_depth' : [2,3],
    'clf__colsample_bytree' : [0.6,0.7,0.8],
    'clf__subsample' : [0.6,0.7,0.8],
    'clf__reg_alpha' : [0.1,0.3],
    'clf__reg_lambda' : [0.5,1],  
    'clf__min_child_weight' : [90,110,150],
    'clf__tree_method' : ['gpu_hist'],
    'clf__objective' : ['multi:softmax'],
    'clf__eval_metric' :['merror'],
    'clf__use_label_encoder' : [False]
}

pipe = Pipeline([('scaler', StandardScaler()),('clf',XGBClassifier(random_state=42,early_stopping_rounds=10))])

met = ['accuracy', 'f1_weighted', 'precision_weighted', 'recall_weighted']

cv = RepeatedStratifiedKFold(n_splits=4, n_repeats=3,random_state=42)

xgb_grid = RandomizedSearchCV(estimator=pipe,param_distributions=param_grid,scoring=met,refit='f1_weighted',cv=cv,verbose =1, n_jobs = -1,n_iter =100)
xgb_grid.fit(train_df[features], train_df.target)
print(xgb_grid.best_score_)
print(xgb_grid.best_params_)
Fitting 12 folds for each of 100 candidates, totalling 1200 fits
[Parallel(n_jobs=-1)]: Using backend LokyBackend with 4 concurrent workers.
[Parallel(n_jobs=-1)]: Done  42 tasks      | elapsed:  1.9min
[Parallel(n_jobs=-1)]: Done 192 tasks      | elapsed:  8.2min
[Parallel(n_jobs=-1)]: Done 442 tasks      | elapsed: 18.2min
[Parallel(n_jobs=-1)]: Done 792 tasks      | elapsed: 32.4min
[Parallel(n_jobs=-1)]: Done 1200 out of 1200 | elapsed: 48.9min finished
0.642928870603918
{'clf__use_label_encoder': False, 'clf__tree_method': 'gpu_hist', 'clf__subsample': 0.6, 'clf__reg_lambda': 0.5, 'clf__reg_alpha': 0.1, 'clf__objective': 'multi:softmax', 'clf__n_estimators': 300, 'clf__min_child_weight': 150, 'clf__max_depth': 3, 'clf__learning_rate': 0.1, 'clf__eval_metric': 'error', 'clf__colsample_bytree': 0.7}
In [ ]:
print('XGBoost Cross Validation Results')
print('')
print('Mean Accuracy Score :',xgb_grid.cv_results_['mean_test_accuracy'].mean())
print('='*20)
print('Mean f1-weighted Score :' ,xgb_grid.cv_results_['mean_test_f1_weighted'].mean())
print('='*20)
print('Mean Precision Score Precision :',xgb_grid.cv_results_['mean_test_precision_weighted'].mean())
print('='*20)
print('Mean Recall Score :',xgb_grid.cv_results_['mean_test_recall_weighted'].mean())
XGBoost Cross Validation Results

Mean Accuracy Score : 0.6459885992070609
====================
Mean f1-weighted Score : 0.641062960340338
====================
Mean Precision Score Precision : 0.648718496379361
====================
Mean Recall Score : 0.6459885992070609
In [ ]:
test_df['target'] = np.where(test_df.Score == 1,1 , np.where(test_df.Score == 0, 2,3 ))
y_pred_xgb = xgb_grid.predict(test_df[features])
target_names = ['White_Wins', 'Black_Wins', 'Draw']
print(classification_report(test_df['target'], y_pred_xgb, target_names=target_names))
              precision    recall  f1-score   support

  White_Wins       0.66      0.59      0.62      2007
  Black_Wins       0.65      0.43      0.52      1485
        Draw       0.61      0.77      0.68      2747

    accuracy                           0.63      6239
   macro avg       0.64      0.60      0.61      6239
weighted avg       0.63      0.63      0.62      6239

In [ ]:
confusion_matrix(test_df['target'], y_pred_xgb)
Out[ ]:
array([[1181,  114,  712],
       [ 213,  640,  632],
       [ 405,  236, 2106]])
In [ ]:
features_importances_xgb_grid = pd.DataFrame(xgb_grid.best_estimator_['clf'].feature_importances_)
features_importances_xgb_grid['feature'] = features
features_importances_xgb_grid = features_importances_xgb_grid.rename(columns={0:'importance'})
features_importances_xgb_grid = features_importances_xgb_grid.sort_values(by = 'importance' , ascending=False)
features_importances_xgb_grid = features_importances_xgb_grid[['feature', 'importance']]
features_importances_xgb_grid.head()
Out[ ]:
feature importance
20 White_eig 0.030835
10 Black_Player_black_draw 0.028878
16 Black_Player_total_score 0.028568
7 White_Player_total_score 0.027802
22 White_cls 0.026595

Ploting most Important Features

In [ ]:
train_df['target_names'] = np.where(train_df.Score == 1 , 'White_Wins', np.where(train_df.Score == 0, 'Black_Wins', 'Draw'))
In [ ]:
train_df.rename(columns ={'1_x':'White_Embeding_1','1_y':'Black_Embeding_1' }, inplace = True)
In [ ]:
fig, axes = plt.subplots(3,3,figsize=(16,9))

plt.subplot(3, 3, 1)
sns.barplot(x = 'target_names', y = 'White_eig', data = train_df)
plt.subplot(3, 3, 2)
sns.barplot(x = 'target_names', y = 'Black_Player_black_draw', data = train_df)
plt.subplot(3,3,3)
sns.barplot(x = 'target_names', y = 'Black_Player_total_score', data = train_df)


plt.subplot(3, 3, 4)
sns.barplot(x = 'target_names', y = 'White_Player_total_score', data = train_df)
plt.subplot(3, 3, 5)
sns.barplot(x = 'target_names', y = 'White_cls', data = train_df)
plt.subplot(3,3,6)
sns.barplot(x = 'target_names', y = 'White_Player_Avg_Score', data = train_df)

plt.subplot(3, 3, 7)
sns.barplot(x = 'target_names', y = 'Black_eig', data = train_df)
plt.subplot(3, 3, 8)
sns.barplot(x = 'target_names', y = 'White_Embeding_1', data = train_df)
plt.subplot(3,3,9)
sns.barplot(x = 'target_names', y = 'Black_Embeding_1', data = train_df)
fig.tight_layout()
plt.show()
In [ ]:
fig, axes = plt.subplots(3,3,figsize=(16,9))

plt.subplot(3, 3, 1)
sns.boxplot(x = 'target_names', y = 'White_eig', data = train_df)
plt.subplot(3, 3, 2)
sns.boxplot(x = 'target_names', y = 'Black_Player_black_draw', data = train_df)
plt.subplot(3,3,3)
sns.boxplot(x = 'target_names', y = 'Black_Player_total_score', data = train_df)


plt.subplot(3, 3, 4)
sns.boxplot(x = 'target_names', y = 'White_Player_total_score', data = train_df)
plt.subplot(3, 3, 5)
sns.boxplot(x = 'target_names', y = 'White_cls', data = train_df)
plt.subplot(3,3,6)
sns.boxplot(x = 'target_names', y = 'White_Player_Avg_Score', data = train_df)

plt.subplot(3, 3, 7)
sns.boxplot(x = 'target_names', y = 'Black_eig', data = train_df)
plt.subplot(3, 3, 8)
sns.boxplot(x = 'target_names', y = 'White_Embeding_1', data = train_df)
plt.subplot(3,3,9)
sns.boxplot(x = 'target_names', y = 'Black_Embeding_1', data = train_df)
fig.tight_layout()
plt.show()